Hello, I have a Catalyst application that occupies 180 MB of RAM if it uses the internal development server. It occupies more than 1 GB of RAM if it uses Apache/mod_perl.
Even though it is very much, it would be OK if the memory usage wouldn't increase on each request. I have started Apache with the -X parameter to use a single process and I have also changed to "1" all the settings for Prefork MPM, but when using the ab utility, the memory usage increases and it creates swap. The memory it occupies also increases if I use the internal development server. So I am pretty sure my app has some memory leaks and I tried to use CatalystX::LeakChecker for finding them. It gave the following results, but I don't know how to interpret them and find the piece of code that create leaks: [debug] Circular reference detected: .------------------------------------------------------------------------. | $ctx->{stash}->{__InstancePerContext_158098900}->{c} | | $ctx->{stash}->{__InstancePerContext_158258668}->{c} | | $ctx->{stash}->{__InstancePerContext_158322332}->{c} | '------------------------------------------------------------------------' I've also tried to use C::P::LeakTracker by adding it to the list of plugins and creating the Leaks.pm controller: package BRK::Controller::Leaks; use Moose; use namespace::autoclean; use parent qw(Catalyst::Controller::LeakTracker); sub index :Path :Args(0) { my ( $self, $c ) = @_; $c->forward("list_requests"); # redirect to request listing view } __PACKAGE__->meta->make_immutable; 1; But when I access it, it gives the error below. Please give me some hints for using these 2 modules, or recommend another way of finding the code that create memory leaks. Thank you. I am using Perl 5.10.1 and Catalyst 5.80025. Here is the error generated when I access /leaks: Couldn't load class (MyApp) because: Couldn't instantiate component "MyApp::Controller::Leaks", "Inconsistent hierarchy during C3 merge of class 'MyApp::Controller::Leaks': merging failed on parent 'Moose::Object' at e:/usr/lib/mro.pm line 24."Compilation failed in require at e:/usr/site/lib/Class/MOP.pm line 114. at e:/usr/site/lib/Class/MOP.pm line 120 Class::MOP::__ANON__('Couldn\'t instantiate component "MyApp::Controller::Leaks", "In...') called at e:/usr/site/lib/Try/Tiny.pm line 98 Try::Tiny::try('CODE(0x2062e54)', 'Try::Tiny::Catch=REF(0x2ae97d4)') called at e:/usr/site/lib/Class/MOP.pm line 125 Class::MOP::load_first_existing_class('MyApp') called at e:/usr/site/lib/Class/MOP.pm line 137 Class::MOP::load_class('MyApp') called at e:/usr/site/lib/Catalyst/ScriptRole.pm line 61 Catalyst::ScriptRole::_run_application('Catalyst::Script::Server=HASH(0x2b16f9c)') called at e:/usr/site/lib/Catalyst/Script/Server.pm line 181 Catalyst::Script::Server::run('Catalyst::Script::Server=HASH(0x2b16f9c)') called at e:/usr/site/lib/Class/MOP/Method/Wrapped.pm line 48 Class::MOP::Method::Wrapped::__ANON__('Catalyst::Script::Server=HASH(0x2b16f9c)') called at e:/usr/site/lib/Class/MOP/Method/Wrapped.pm line 89 Catalyst::Script::Server::run('Catalyst::Script::Server=HASH(0x2b16f9c)') called at e:/usr/site/lib/Catalyst/ScriptRunner.pm line 20 Catalyst::ScriptRunner::run('Catalyst::ScriptRunner', 'MyApp', 'Server') called at script/myapp_server.pl line 8 -- Octavian __________ Information from ESET NOD32 Antivirus, version of virus signature database 5363 (20100813) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com
_______________________________________________ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/