Re: leak?
Mark Overmeer <[email protected]> Tue, 24 Aug 2004 15:23:09 +0200
| Newsgroups | gmane.comp.lang.perl.modules.mail-box |
|---|---|
| Organization | MARKOV Solutions |
| Message-ID | <[email protected]> |
* Jon Wilson ([email protected]) [040824 14:33]: > I've noticed a memory leak when I clone messages. Test code and test > message attached. It's probably some kind of circular reference. It > doesn't happen if I don't clone the message. When you remove the clone() from your code, it still leaks memory. I am not familiar with Devel::Leak, but does it understand Scalar::Util::weaken() ? I have used that a lot, but may have missed one or two spots. When you open an mbox folder, it will be lazy: only the headers will be taken in memory. When you clone the messages, the bodies will get stored in memory as well. So: it is very normal that the memory usage explodes when you go through the whole folder. See $msg->destruct() [if you know what you are doing]. If you are willing to persue the "leak" further, than be my guest. There may be many reasons within Perl, Devel::Leak, Scalar::Util, or even Mail::Box which produce this result. By the way: I see no reason for creating a clone() in normal applications. When you move messages from one folder to the other, MailBox will do that as efficiently as possible for you. (see $msg->move, $msg->copy, etc) -- MarkOv ------------------------------------------------------------------------ drs Mark A.C.J. Overmeer MARKOV Solutions [email protected] [email protected] http://Mark.Overmeer.net http://solutions.overmeer.net