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
|