Hi,
I'm trying to understand whether a large program I'm dealing with has memory leaks. I did some search, and in all the places where Perl's memory use is discussed, it says something like this:
- Perl's garbage collector works by counting references.
- If your code contains circular references, the garbage collector will not be able to free that memory, as the reference count won't go down to 0.
- The simple solution is to use weakened refs.
- If you don't do this, the memory will not be freed until the program is terminated.
Now, the code I'm dealing with certainly contains circular references. But before I start looking up all those and weakening them, I wanted to understand something:
If I reach the end of my program, and it terminates as it should - is the memory with the circular references freed anyway? If it is, does it mean that technically, there can be no such thing as a memory leak in perl as long as the program isn't interrupted? What happens if it is interrupted? I couldn't find definite answers to these questions...
Thanks a lot!In reply to Memory and garbage collection by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |