Opened 18 years ago

Closed 15 years ago

#1859 closed defect (invalid)

php/mapscript has a memory leak

Reported by: woodbri@… Owned by: aboudreault
Priority: high Milestone: 5.6 release
Component: MapScript-PHP Version: 4.10
Severity: normal Keywords:
Cc: dmorissette

Description (last modified by dmorissette)

I just updated to mapserver nightly (Aug 9, 2006) and I'm running the ka-map precache2.php modified to run in apache. The previous fix to solve the leaking file handles improves things greatly, but there is still a memory leak.

If I restart apache and fire off the script it uses a modest amount of memory, under 300MB for the process. Since I'm running 25000 scale, it runs a long time, and after 24 hours the process is using over 1GB of memory.

I can send my copy of precache2.php if that would help. The mapfile uses:

  OUTPUTFORMAT
    NAME PNG8
    DRIVER "GD/PNG"
    EXTENSION "png"
    MIMETYPE "image/png"
    IMAGEMODE RGBA
    TRANSPARENT OFF
    FORMATOPTION "QUANTIZE_FORCE=ON"
    FORMATOPTION "QUANTIZE_DITHER=OFF"
    FORMATOPTION "QUANTIZE_COLORS=256"
  END

I assume this is reproducible with any mapfile.

Change History (6)

comment:1 by dmorissette, 18 years ago

There is always the possibility of a leak, but as Ned Harding pointed out on the
list, chances are high that this is just caused by memory fragmentation.

And even if there is a leak, there is nothing that tells us (yet) that it is in
PHP MapScript and not in PHP or in other support libs used by the precache
script. If you could run your process under Valgrind that would tell you right
away if there is a leak (and where) and then that would help us help you a lot.

comment:2 by tomkralidis, 15 years ago

Any update on this one?

comment:3 by woodbri, 15 years ago

I have modified the script to run under php-cli and I can confirm that the problem still existed in released software ago the Aug/Sept timeframe when I last ran it for a client. I have mostly just worked around the issue by by generating N rows of tiles, then starting a new process to do N more rows, etc until it is done.

I never had time to run it under valgrind and it seemed to complicated to run php in apache in valgrind. I would be easier to do it with the command line version.

comment:4 by dmorissette, 15 years ago

Cc: dmorissette added
Description: modified (diff)
Milestone: 5.6.0 release
Owner: changed from mapserverbugs to aboudreault

Alan, can you please see if you can reproduce this?

comment:5 by aboudreault, 15 years ago

Stephen, could you provide me the scripts that you use to reproduce that bug please? (using php-cli)

comment:6 by aboudreault, 15 years ago

Resolution: invalid
Status: newclosed

I have not been able to reproduce that bug with mapserver svn. If anyone can provide mapfile/data to reproduce it, please reopen the bug.

Note: See TracTickets for help on using tickets.