[Mapserver-users] PHP undef WAS: Memory Leak?

Daniel Morissette morissette at dmsolutions.ca
Fri Jan 31 12:22:16 EST 2003


Lowell Filak wrote:
> 
> I will have to forward that request back to the list for the PHP folks to answer.
> Anyone who can help, please reply to germangutierrezg at yahoo.es .
> Thank you.
> 
> The following message was sent by "Juanse" <georef at tie.cl> on Fri, 31 Jan 2003 10:40:56 -0300.
> 
> > yes it is, but how to undef/close/destroyed? which command it is not in the
> > docs.
> >

The garbage collection should happen automagically in PHP when the
variable is overwritten or becomes out of scope... but there are always
chances that something is not being cleaned up properly, or that some
resources (PHP terminology for internal data structures) may not be
registered or cleaned properly.

I think this will have to be investigated further, but unfortunately we
don't have much time for that now.  You may want to file a bug about
this.

In the meantime, you could launch a new PHP instance for each map in a
loop using the system() call, e.g.

  <?php
    for ($i=0; $i... 2232 iterations)
    {
       ...
       system("/path/to/php draw_a_map.php $map_name_and_params[$i]");
    }
  ?>

I know this is a hack, but at least this way you'll be able to get your
maps done and won't have to wait for a fix.  A new process will be
started by system() for each map and you won't run into issues because
of memory leaks.

-- 
------------------------------------------------------------
 Daniel Morissette               morissette at dmsolutions.ca
 DM Solutions Group              http://www.dmsolutions.ca/
------------------------------------------------------------



More information about the mapserver-users mailing list