Re: Memory leak or expected behavior?
From: zentara (zentara_at_highstream.net)
Date: 12/31/04
- Next message: Chris Mattern: "Re: another newbie stupid question"
- Previous message: Tad McClellan: "Re: another newbie stupid question"
- In reply to: syost_at_quicktopic.com: "Re: Memory leak or expected behavior?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 31 Dec 2004 10:31:10 -0500
On 30 Dec 2004 08:31:59 -0800, syost@quicktopic.com wrote:
>OTOH I do see memory usage as reported by 'ps' grow incrementally in my
>Apache/mod_perl httpd processes (usu. from about 10M to 50M over their
>lifetimes) , so I guess I've got to look for circular references. Or
>maybe there is no leak, but instead the variations in client usage of
>each web page bump the memory out, and as we know it's not given back
>to the OS until the process dies.
>Thanks again. Any other comments welcome.
>
>Steve
My experience with objects 'leaking' memory ( not a true leak, but
it looks like one ) comes from using Tk.
In Tk you need to reuse objects, because it keeps a reference to
all objects internally, so they never go out of scope. So the examples
we were using, would leak if used in Tk. I'm hazarding a guess that
mod_perl is doing the same thing.
In Tk, I reuse objects by first creating a numbered pool of objects
based on the maximum I will need in play at any one time. Then when I'm
done with an object I return it to the queue-pool, ready to be
reconfigured and reused.
For instance if I have a bunch of photos to process, I will make enough
photo objects to handle what will be on-screen at any one time. When
I need to bring up new ones, I don't undef the old objects and create
new ones, I use "configure" on them, to interanlly clear them out and
fill them with fresh data.
This is probably the biggest mistake new Tk programmers run into,
they build apps depending on creating-destroying objects, and never
watch their memory.
So I'm gussing this is what is happening in your mod_perl. Instead
of trying to track down where the hidden reference is( you probably
won't); work on a scheme of reusable objects.
-- I'm not really a human, but I play one on earth. http://zentara.net/japh.html
- Next message: Chris Mattern: "Re: another newbie stupid question"
- Previous message: Tad McClellan: "Re: another newbie stupid question"
- In reply to: syost_at_quicktopic.com: "Re: Memory leak or expected behavior?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|