Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

High memory consumption problem

by ghosh123 (Monk)
on Mar 20, 2012 at 05:56 UTC ( [id://960526]=perlquestion: print w/replies, xml ) Need Help??

ghosh123 has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks, In my project the application is taking high memory when running since one object is holding the other and hence lot of memory remains unused. I have used Devel::findRef::track to find out how many refcounts are there. Please suggest me a way so that I can proceed further. I am not sure how go ahead and reduce the memory from the information FindRef::track has given me. I have used Scalar::Utils::weaken but did not help. Is there any generic rule to minimise the memory use from this info ? Thanks. Abhijit

Replies are listed 'Best First'.
Re: High memory consumption problem
by Anonymous Monk on Mar 20, 2012 at 06:22 UTC
Re: High memory consumption problem
by BrowserUk (Patriarch) on Mar 20, 2012 at 06:14 UTC

    You could try posting (a sample of) the module output. Someone might be able to assist you from that.

    Otherwise you'll need to post (some of) the code that demonstrates the problem.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

    The start of some sanity?

      Well the sample output looks something like this :

      [2012/03/20 11:00:46] GuiTasks.Gui.TaskGenJobExecDisplay 229 - REF(0xa +afdff0) [refcount 12] is +- the lexical '$self' in CODE(0xb486638) [refcount 1], which is | +- the closure created at /var/vob/relman/admin/vob/wotantool/admin +/deploy/base/lib/perl/GuiTasks/Gui/TaskGenJobExecDisplay.pm:266. | +- referenced by REF(0xb3a1780) [refcount 1], which is | the array element 0 of Tk::Callback=ARRAY(0xb256028) [refcount 1 +], which is | referenced by REF(0xb25601c) [refcount 1], which is | not found anywhere I looked :( +- referenced by REF(0xb485a80) [refcount 1], which is | a temporary on the stack. +- the lexical '$self' in CODE(0xb4841e4) [refcount 1], which is | +- referenced by REF(0xb5787fc) [refcount 1], which is | | the array element 0 of Tk::Callback=ARRAY(0xb5787d8) [refcount 1 +], which is | | referenced by REF(0xb227b84) [refcount 1], which is | | not found anywhere I looked :( | +- the closure created at /var/vob/relman/admin/vob/wotantool/admin +/deploy/base/lib/perl/GuiTasks/Gui/TaskGenJobExecDisplay.pm:245. +- the lexical '$self' in CODE(0xb483ae8) [refcount 3], which is | +- the closure created at /var/vob/relman/admin/vob/wotantool/admin +/deploy/base/lib/perl/GuiTasks/Gui/TaskGenJobExecDisplay.pm:229. | +- referenced by REF(0xb4bd3cc) [refcount 2], which is | the array element 0 of Tk::Callback=ARRAY(0x9fdf09c) [refcount 2 +], which is | +- referenced by REF(0xb4b8864) [refcount 2], which is | | not found anywhere I looked :( | +- referenced by REF(0x9fdad64) [refcount 1], which is | not found anywhere I looked :( +- the lexical '$self' in CODE(0xb4e0e18) [refcount 1], which is | +- the closure created at /var/vob/relman/admin/vob/wotantool/admin +/deploy/base/lib/perl/GuiTasks/Gui/TaskGenJobExecDisplay.pm:293. | +- referenced by REF(0xb3b8168) [refcount 1], which is | the array element 0 of Tk::Callback=ARRAY(0xb4b31b0) [refcount 1 +], which is | referenced by REF(0xb3d5da0) [refcount 1], which is | not found anywhere I looked :( +- the lexical '$self' in CODE(0xb4dbe98) [refcount 1], which is | +- the closure created at /var/vob/relman/admin/vob/wotantool/admin +/deploy/base/lib/perl/GuiTasks/Gui/TaskGenJobExecDisplay.pm:237. | +- referenced by REF(0xb22bddc) [refcount 1], which is | the array element 0 of Tk::Callback=ARRAY(0xb4d3808) [refcount 1 +], which is | referenced by REF(0xb31f490) [refcount 1], which is | not found anywhere I looked :( +- the lexical '$self' in CODE(0xb4d3e50) [refcount 1], which is | +- referenced by REF(0xb5a5364) [refcount 1], which is | | the array element 0 of Tk::Callback=ARRAY(0xb4b14b4) [refcount 1 +], which is | | referenced by REF(0xb4b155c) [refcount 1], which is | | not found anywhere I looked :( | +- the closure created at /var/vob/relman/admin/vob/wotantool/admin +/deploy/base/lib/perl/GuiTasks/Gui/TaskGenJobExecDisplay.pm:273. +- the lexical '$self' in CODE(0xb4368b0) [refcount 1], which is | +- the closure created at /var/vob/relman/admin/vob/wotantool/admin +/deploy/base/lib/perl/GuiTasks/Gui/TaskGenJobExecDisplay.pm:259. | +- referenced by REF(0x9fd4104) [refcount 1], which is | the array element 0 of Tk::Callback=ARRAY(0xb519d68) [refcount 1 +], which is | referenced by REF(0xb4872c8) [refcount 1], which is | not found anywhere I looked :( +- the lexical '$self' in CODE(0xb3a98ac) [refcount 1], which is | +- referenced by REF(0xb5932b8) [refcount 1], which is | | the array element 0 of Tk::Callback=ARRAY(0x9fd9cc0) [refcount 1 +], which is | | referenced by REF(0xb311d00) [refcount 1], which is | | not found anywhere I looked :( | +- the closure created at /var/vob/relman/admin/vob/wotantool/admin +/deploy/base/lib/perl/GuiTasks/Gui/TaskGenJobExecDisplay.pm:287. +- the lexical '$self' in CODE(0xb364d40) [refcount 1], which is | +- the closure created at /var/vob/relman/admin/vob/wotantool/admin +/deploy/base/lib/perl/GuiTasks/Gui/TaskGenJobExecDisplay.pm:252. | +- referenced by REF(0x9fd06fc) [refcount 1], which is | the array element 0 of Tk::Callback=ARRAY(0xb28372c) [refcount 1 +], which is | referenced by REF(0xb25ccf8) [refcount 1], which is | not found anywhere I looked :( +- the lexical '$self' in CODE(0xb31b854) [refcount 1], which is | +- the closure created at /var/vob/relman/admin/vob/wotantool/admin +/deploy/base/lib/perl/GuiTasks/Gui/TaskGenJobExecDisplay.pm:281. | +- referenced by REF(0xb24cc60) [refcount 1], which is | the array element 0 of Tk::Callback=ARRAY(0xb507c90) [refcount 1 +], which is | referenced by REF(0xb4b14f0) [refcount 1], which is | not found anywhere I looked :( +- the lexical '$self' in CODE(0xb2348ac) [refcount 1], which is +- referenced by REF(0xb264784) [refcount 1], which is | the array element 0 of Tk::Callback=ARRAY(0xb201c20) [refcount 1 +], which is | referenced by REF(0x9fdc9c0) [refcount 1], which is | not found anywhere I looked :( +- the closure created at /var/vob/relman/admin/vob/wotantool/admin +/deploy/base/lib/perl/GuiTasks/Gui/TaskGenJobExecDisplay.pm:222. [2012/03/20 11:00:46] GuiTasks.Gui.TaskGenJobExecDisplay 229 - REF(0xa +afdff0) [refcount 12] is +- the lexical '$self' in CODE(0xb486638) [refcount 1], which is | +- the closure created at /var/vob/relman/admin/vob/wotantool/admin +/deploy/base/lib/perl/GuiTasks/Gui/TaskGenJobExecDisplay.pm:266. | +- referenced by REF(0xb3a1780) [refcount 1], which is | the array element 0 of Tk::Callback=ARRAY(0xb256028) [refcount 1 +], which is | referenced by REF(0xb25601c) [refcount 1], which is | not found anywhere I looked :( +- referenced by REF(0xb485a80) [refcount 1], which is | a temporary on the stack. +- the lexical '$self' in CODE(0xb4841e4) [refcount 1], which is | +- referenced by REF(0xb5787fc) [refcount 1], which is | | the array element 0 of Tk::Callback=ARRAY(0xb5787d8) [refcount 1 +], which is | | referenced by REF(0xb227b84) [refcount 1], which is | | not found anywhere I looked :( | +- the closure created at /var/vob/relman/admin/vob/wotantool/admin +/deploy/base/lib/perl/GuiTasks/Gui/TaskGenJobExecDisplay.pm:245. +- the lexical '$self' in CODE(0xb483ae8) [refcount 3], which is | +- the closure created at /var/vob/relman/admin/vob/wotantool/admin +/deploy/base/lib/perl/GuiTasks/Gui/TaskGenJobExecDisplay.pm:229. | +- referenced by REF(0xb4bd3cc) [refcount 2], which is | the array element 0 of Tk::Callback=ARRAY(0x9fdf09c) [refcount 2 +], which is | +- referenced by REF(0xb4b8864) [refcount 2], which is | | not found anywhere I looked :( | +- referenced by REF(0x9fdad64) [refcount 1], which is | not found anywhere I looked :( +- the lexical '$self' in CODE(0xb4e0e18) [refcount 1], which is | +- the closure created at /var/vob/relman/admin/vob/wotantool/admin +/deploy/base/lib/perl/GuiTasks/Gui/TaskGenJobExecDisplay.pm:293. | +- referenced by REF(0xb3b8168) [refcount 1], which is | the array element 0 of Tk::Callback=ARRAY(0xb4b31b0) [refcount 1 +], which is | referenced by REF(0xb3d5da0) [refcount 1], which is | not found anywhere I looked :( +- the lexical '$self' in CODE(0xb4dbe98) [refcount 1], which is | +- the closure created at /var/vob/relman/admin/vob/wotantool/admin +/deploy/base/lib/perl/GuiTasks/Gui/TaskGenJobExecDisplay.pm:237. | +- referenced by REF(0xb22bddc) [refcount 1], which is | the array element 0 of Tk::Callback=ARRAY(0xb4d3808) [refcount 1 +], which is | referenced by REF(0xb31f490) [refcount 1], which is | not found anywhere I looked :( +- the lexical '$self' in CODE(0xb4d3e50) [refcount 1], which is | +- referenced by REF(0xb5a5364) [refcount 1], which is | | the array element 0 of Tk::Callback=ARRAY(0xb4b14b4) [refcount 1 +], which is | | referenced by REF(0xb4b155c) [refcount 1], which is | | not found anywhere I looked :( | +- the closure created at /var/vob/relman/admin/vob/wotantool/admin +/deploy/base/lib/perl/GuiTasks/Gui/TaskGenJobExecDisplay.pm:273. +- the lexical '$self' in CODE(0xb4368b0) [refcount 1], which is | +- the closure created at /var/vob/relman/admin/vob/wotantool/admin +/deploy/base/lib/perl/GuiTasks/Gui/TaskGenJobExecDisplay.pm:259. | +- referenced by REF(0x9fd4104) [refcount 1], which is | the array element 0 of Tk::Callback=ARRAY(0xb519d68) [refcount 1 +], which is | referenced by REF(0xb4872c8) [refcount 1], which is | not found anywhere I looked :( +- the lexical '$self' in CODE(0xb3a98ac) [refcount 1], which is | +- referenced by REF(0xb5932b8) [refcount 1], which is | | the array element 0 of Tk::Callback=ARRAY(0x9fd9cc0) [refcount 1 +], which is | | referenced by REF(0xb311d00) [refcount 1], which is | | not found anywhere I looked :( | +- the closure created at /var/vob/relman/admin/vob/wotantool/admin +/deploy/base/lib/perl/GuiTasks/Gui/TaskGenJobExecDisplay.pm:287. +- the lexical '$self' in CODE(0xb364d40) [refcount 1], which is | +- the closure created at /var/vob/relman/admin/vob/wotantool/admin +/deploy/base/lib/perl/GuiTasks/Gui/TaskGenJobExecDisplay.pm:252. | +- referenced by REF(0x9fd06fc) [refcount 1], which is | the array element 0 of Tk::Callback=ARRAY(0xb28372c) [refcount 1 +], which is | referenced by REF(0xb25ccf8) [refcount 1], which is | not found anywhere I looked :( +- the lexical '$self' in CODE(0xb31b854) [refcount 1], which is | +- the closure created at /var/vob/relman/admin/vob/wotantool/admin +/deploy/base/lib/perl/GuiTasks/Gui/TaskGenJobExecDisplay.pm:281. | +- referenced by REF(0xb24cc60) [refcount 1], which is | the array element 0 of Tk::Callback=ARRAY(0xb507c90) [refcount 1 +], which is | referenced by REF(0xb4b14f0) [refcount 1], which is | not found anywhere I looked :( +- the lexical '$self' in CODE(0xb2348ac) [refcount 1], which is +- referenced by REF(0xb264784) [refcount 1], which is | the array element 0 of Tk::Callback=ARRAY(0xb201c20) [refcount 1 +], which is | referenced by REF(0x9fdc9c0) [refcount 1], which is | not found anywhere I looked :( +- the closure created at /var/vob/relman/admin/vob/wotantool/admin +/deploy/base/lib/perl/GuiTasks/Gui/TaskGenJobExecDisplay.pm:222. [1] Done home/tool/script.pl

        Hello Monks, Also in support of the above output I am including the function block which the output refers. Please look at the following snippet where I have used Devel::FindRef. You will also find atleast 11 menus have been created by $contextmenu->add( ...) and hence it shows 11+1 = 12 refcounts. Please help.

        sub TaskGenJobExecDisplay::_Menu () { my TaskGenJobExecDisplay $self = shift; my $contextMenu = $self->jobTree()->Menu( -tearoff => 0 ); $contextMenu->add( 'command', -label => 'Kill', -command => sub { $self->onMenuKill(@_) }, -font => $tool_config::FONT_BIG ); $contextMenu->add( 'command', -label => 'Delete', -command => sub { print TE "deleting jobs :$self \n";$sel +f->onMenuDelete(@_);weaken($self); $logger->info(Devel::FindRef::trac +k \$self); }, -font => $tool_config::FONT_BIG ); $contextMenu->add('separator'); $contextMenu->add( 'command', -label => 'Edit Profile', -command => sub { $self->onMenuEditProfile(@_) }, -font => $tool_config::FONT_BIG ); $contextMenu->add('separator'); $contextMenu->add( 'command', -label => 'Show Logfile', -command => sub { $self->onMenuShowLogfile(0) }, -font => $tool_config::FONT_BIG ); $contextMenu->add( 'command', -label => 'Show Logfile Sep. Window', -command => sub { $self->onMenuShowLogfile(1) }, -font => $tool_config::FONT_BIG ); $contextMenu->add('separator'); $contextMenu->add( 'command', -label => 'Restart', -command => sub { $self->onMenuRestart( @_, 0 ) }, -font => $tool_config::FONT_BIG ); $contextMenu->add( 'command', -label => 'Edit & Restart', -command => sub { $self->onMenuRestart( @_, 1 ) }, -font => $tool_config::FONT_BIG ); $contextMenu->add( 'command', -label => 'Restart (incl. predecessors)', -command => sub { $self->onMenuRestartWithPredecessors( @_, 0 +) }, -font => $tool_config::FONT_BIG ); $contextMenu->add('separator'); $contextMenu->add( 'command', -label => 'Unlock', -command => sub { $self->onMenuUnlock(@_) }, -font => $tool_config::FONT_BIG ); $contextMenu->add( 'command', -label => 'Force Ok', -command => sub { $self->onMenuForceStatus( @_, $communic +ation::OK ) }, -font => $tool_config::FONT_BIG ); $contextMenu->add( 'command', -label => 'Force failed', -command => sub { $self->onMenuForceStatus( @_, $communic +ation::ERROR ) }, -font => $tool_config::FONT_BIG );

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://960526]
Approved by BrowserUk
Front-paged by BrowserUk
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (5)
As of 2024-04-23 15:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found