Re: Perl FCGI process and Perl's garbage collection
"Guorui Wu" <[email protected]>
| Newsgroups | gmane.comp.web.fastcgi.devel |
|---|---|
| Message-ID | <[email protected]> |
Thank you, It is a real leak resulting from circular reference in a large hierarchy / nested object tree. employed the Scalar::Util qw(weaken) in applicable places and no more leaks observed. will also implement your methods to restart the process. Thanks Galen On 7/17/07, Sam Vilain <sam-s9IUA/[email protected]> wrote: > Yes, I concur that you probably have a real leak. If the memory was > being freed for use by Perl then it should be used in preference to the > other stuff. Try the tools - Devel::Cycle, etc. > > Another option I've used in the past is to periodically check > /proc/self/stat (on Linux) to see how big the current process is and > exit if it goes over a threshold. A slightly more efficient and more > portable option would be to write an XS wrapper for getrusage(2). > > Sam. > > ps Top poster!! :P > > David Birnbaum wrote: > > Galen, > > > > I thought that, as of Perl 5.6, the system malloc() was the default on > > most implementations, which returns memory back to the system. Maybe > > you need to see how your Perl was compiled? Or perhaps you're not > > freeing memory when you think you are. > > > > We have, in our applications, had a counter that caused it to exit > > after X iterations, just to clear up other memory bugs. It's not a > > big problem, as long as your counter is sufficiently high. > > > > David. > > > > ------------------------------------------------------------------------ > > > > Guorui Wu wrote: > >> HI, > >> > >> On most system, Garbage collection of a perl process does Not return > >> the memory freed to system, instead, it reserves it for its (the perl > >> process) future use. > >> > >> I am developing a Perl FCGI application. ab stress test with 30,000 > >> requests result in a huge accumulated memory footprint for the FCGI > >> perl process. > >> > >> My question is: even if the code is clean, but due to perl's garbage > >> collection behavior as stated above, a long run perl FCGI process will > >> bound to accumulate memory footprint. so we have to spawn a new > >> process once over some time and exit the parent? > >> > >> Is my understanding correct? or any other alternative solution to this > >> problem so that perl FCGI process Does return memory to the OS? > >> > >> Many thanks > >> > >> Galen > >> ___________________________________ > >> fastcgi-developers mailing list > >> http://fastcgi.com/fastcgi-developers/ > >> > > ------------------------------------------------------------------------ > > > > ___________________________________ > > fastcgi-developers mailing list > > http://fastcgi.com/fastcgi-developers/ > > > > ___________________________________ fastcgi-developers mailing list http://fastcgi.com/fastcgi-developers/