logo       

Re: Memory Usage: msg#00086

Subject: Re: Memory Usage
On 25 Jul 2004 at 14:43, Jesse Schoch wrote:

> Some more data...
> 
> perl memtest.pl   8956K <-taskmanager 
> 
> pp -o memtest.exe memtest.pl
> 
> memtest.exe 1984K
> memtest.exe 14944K
> 

14944K - 8956K = 5988K is the expected par.pl frontend memory use.

> pp --gui -o memtest.exe memtest.pl
> 
> memtest.exe 1144K
> memtest.exe 14156K
> 

Slightly less with no console allocation.

> pp --gui -d -o memtest.exe memtest.pl
> 
> memtest.exe 1144K
> memtest.exe 14160K
> 

And no significant difference for non-threaded -d apps.

> Myapp perl myapp.pl (should have 1 main 2 worker threads + 1 hidden
> thread for threads::shared)
> 
> perl.exe 23308K while Idle
> 
> 
> my app pp -d --gui -o myapp.exe myapp.pl
> 
> myapp.exe 33620K
> 

33620K - 23308K = 10312K
10312K - 4888K = 5424K looks like each additional thread may load a new copy of 
perl5x.dll and initialize a perl interpreter. Perl.exe by itself without a 
script uses 
about 1600K. ?? 5424K roughly equal to 1600K times 3 additional threads ??

> my app pp --gui -o myapp.exe myapp.pl 
> 
> myapp.exe 28196K

28196K - 23308K = 4888K par.pl frontend use subtracted above.

> 
> I can only assume this discrepency has something to do with the thread
> creation process on win32. or sharing vars with threads::shared.
> 
> Now I notice that it gets swapped out in taskmanager, but I'd like to
> get the working mem down to the perl.exe myapp.pl version.

To get down to perl.exe memory use, you have two problems to solve.
1. how to unload the par.pl use before the app runs (I've come up empty handed 
on 
that).
2. how to prevent threads from duplicating memory use or how to get different 
threads 
to use the same dlls in memory. I think that is outside the realm of PAR.

> I wonder
> if the thread lib grabbs all the par dependent libs when it clones for
> the new thread.

If starting threads duplicates modules and/or dlls, I would expect it to do 
that for 
all modules, the ones loaded by par.pl and the ones loaded by your app. By the 
time 
your app starts a thread, there is no difference to perl between the two sets.

> Using "require <lib>;<lib>->import();" inplace of
> "use <lib>" may help, but i'm not sure how perl's module loader deals
> with not loading the same module in memory twice.

The perl require processing looks in %INC to see if the module is loaded 
already, and 
Windows itself won't load a dll that's the same as one in memory. Caveat: 
that's true 
for non-threaded apps.

> 
> I will continue to look into this a bit later tonight.
> 
> 

Second caveat: I am only guessing.
Good luck :)

Alan Stewart





<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
boot-loaders.gr...    php.pear.genera...    debugging.valgr...    kde.redhat.user...    text.xml.xsl.ge...    culture.languag...    hardware.microc...    java.servicemix...    redhat.release....    web.zope.plone....    user-groups.lin...    opendarwin.webk...    video.mjpeg.use...    sysutils.bcfg2....    encryption.gpg....    lx-office.devel...    xfree86.forum/2...    mail.mutt.devel...    acpi.devel/2003...    qnx.openqnx.dev...    network.irc.irs...    freebsd.devel.m...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe