in reply to Re^2: modularization, memory usage and performance
in thread modularization, memory usage and performance
Why create a CGI object at all? Doesn't HTTP::Server::Simple give that to you when it calls handle_request?
But to answer your question: garbage collection happens, as I understand it, when the last reference to an object disappears. As long as something refers to an object, it sticks around. This can be annoying, for example, when you've got a closure, so be careful. ;-)
Also note that as you use the CGI module, it loads more of itself into memory and compiles more, and then it stays in case it is called a second time. So if each request causes you to call more parts of CGI.pm, that isn't a leak, it's just that you used more code, so more code had to be loaded and compiled. Avoiding using CGI any more than you have to (e.g., using templates for HTML rather than CGI's html code) may be a good idea here for many reasons, including this one.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: modularization, memory usage and performance
by jmagiera (Novice) on Feb 09, 2005 at 02:39 UTC | |
by tye (Sage) on Feb 09, 2005 at 03:35 UTC | |
by jmagiera (Novice) on Feb 09, 2005 at 08:03 UTC |