THIS->acs_map = allocate_array( 512 ); add_ref( THIS->acs_map );
...
Pike_error( "Unexpected large acs_map!" );
This is exactly why you want to use the stack. You need to free the array before you throw the error, otherwise. If you call anything that can throw an error you need to catch that too, and free the array in that case as well.