CatalystX::LeakChecker - Debug memory leaks in Catalyst applications
version 0.02
package MyApp; use namespace::autoclean; extends 'Catalyst'; with 'CatalystX::LeakChecker'; __PACKAGE__->setup;
It's easy to create memory leaks in Catalyst applications and often they're hard to find. This module tries to help you finding them by automatically checking for common causes of leaks.
Right now, only one cause for leaks is looked for: putting a closure, that closes over the Catalyst context (often called $ctx or $c), onto the stash, without weakening the reference first. More checks might be implemented in the future.
$ctx
$c
This module is intended for debugging only. I suggest to not enable it in a production environment.
If any leaks were found, this method is called at the end of each request. A list of leaks is passed to it. It logs a debug message
[debug] Leaked context from closure on stash: .------------------------------------------------------+-----------------. | Code | Variable | +------------------------------------------------------+-----------------+ | { | $ctx | | package TestApp::Controller::Affe; | | | use warnings; | | | use strict 'refs'; | | | $ctx->response->body('from leaky closure'); | | | } | | '------------------------------------------------------+-----------------'
Override this method if you want leaks to be reported differently.
Florian Ragwitz <rafl@debian.org>
This software is copyright (c) 2009 by Florian Ragwitz.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install CatalystX::LeakChecker, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CatalystX::LeakChecker
CPAN shell
perl -MCPAN -e shell install CatalystX::LeakChecker
For more information on module installation, please visit the detailed CPAN module installation guide.