http://qs321.pair.com?node_id=677971


in reply to Name matching -memory leakage

Well, you don't provide any example code, so it's hard to give good advice. Given your description, though, I can make a couple of guesses.

My first guess is that it isn't a memory leak, but simply that you're running out of available memory (a memory leak is a very specific kind of bug).

Given that, my second guess is that you're loading the entire files into memory before operating on them. If your records are large enough, the combination of doing that and building your output data structure might put you over your available RAM.

One simple way to avoid that is to put your data -- including your output structure -- into a database. That way, the database engine takes care of memory allocation, etc. DBD::SQLite is very nice for this, as it's a simple RDBMS entirely contained in a Perl module.

Beyond that advice, memory bugs are difficult to trace down without seeing code. Share some code, and you'll likely get more help. You may also want to check out How (Not) To Ask A Question for tips about asking questions on PerlMonks in a way that's optimized for getting good answers.

<radiant.matrix>
Ramblings and references
The Code that can be seen is not the true Code
I haven't found a problem yet that can't be solved by a well-placed trebuchet