Perl-Sensitive Sunglasses | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Firstly, I'm not a Dancer user. What follows is just a suggestion for something to try; it may not help at all! In each of your coderefs (get ... sub { ...} [1 instance] and ajax ... sub { ...} [2 instances]), you have code like this:
When they (implicitly) return, @messages will not be garbage-collected while the reference (\@messages) still exists. I don't know why that reference might still exist. I followed it through Dancer (1.3116) source:
and then through Dancer::Template::Abstract (1.3116) source:
but then, not knowing what templating engine you were using, was unable to continue. I'll leave that as an exercise for you. You can ensure @messages is garbage-collected by using this code instead (which contructs an anonymous arrayref):
Expanding @messages will incur some overhead but that appears to be very small. Also, you might just be deferring your memory leak problem. Be aware that memory may not be leaked on every cycle: a linear increase in memory usage may not be occurring at all. It might happen in code that's only run conditionally or perhaps as a result of some exception. -- Ken In reply to Re^3: How to deal with the fact that Perl is not releasing memory
by kcott
|
|