What I do now is to compile any .pl script as a .exe (everyone with perl58.dll). It works fine....but it uses a lot of memory.
Are you sure? (Ie. How are you measuring the memory usage?)
Generally, only one copy of any given .DLL is loaded into memory regardless of how many processes use it.
Although each process will display the memory used by the dll as a part of (one of the figures for) its memory consumption, as displayed in the task manager, second and subsequent copies will usually not consume extra from the total memory pool.
Eg. If I run a do nothing perl process: perl -e"<>", and check the memory usage on the Process Manager main screen, it lists it as using 5,592kb. If I then double click that entry and look at the "Performance" tab, in the "Physical Memory" box, it show the working set as 5.592k. But that is divided into 3 subsets of memory
- WS private: 2,200k ## This is exclusive to this process
- WS shareable: 3,392k ## The rest (2,200 + 3,392 = 5,592) can be shared with other processes.
- WS shared: 2,512k ## Of the 3,392k, 2,512 is currently being shared.
In this case, as there are no other Perl processes running, that will be things like the C runtime DLL, code pages etc. that are a part of other compiled C applications.
And if you monitor the Physical Memory ("System Info" dialog), when you start that first copy of perl, you'll see that the Available memory drops by roughly 2.2 MB.
If you then start a second copy of perl in another session, whilst continuing to monitor the Performance tab of the first, you'll see the WS shared increase to 3,388k. This is because the second copy of Perl is now sharing the Perl5x.dll that was loaded by the first perl process. Now almost all the shareable memory is being shared.
So, whilst summing the main screen memory allocations for the two perl processes suggests they are using 5.592 * 2 = 11 MB, in fact between them they are only using 2.2 * 2 + 3.3 = 7.7MB. And of that 2.5 MB is being shared with other pre-existing processes.
And when starting a third, instead of 16.5MB, only 9.9MB is actually consumed.
This information doesn't mitigate the on-disk redundancy of each having it's own copy of perl5x.dll, but it might stop you worrying about memory consumed by them.
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.
| [reply] [d/l] |
| [reply] |
I believe that you need to either include the DLL or have Perl installed on the machine. That's based on the following excerpt from the Perl Dev Kit User Guide:
The PerlApp utility converts a Perl program into an executable file. The executable can be freestanding (for use on systems where Perl is not installed), or dependent (for use on systems where Perl is installed). Freestanding programs built with PerlApp are larger in size than dependent applications because required Perl modules are included in the executable.
The only other alternative would be to copy the perl58.dll to the other machine. I believe that ActiveState's licensing does allow for that, especially since PerlApp is essentially bundling it into the stand-alone executables.
| [reply] |
The guiding principle behind tools like these is: “let it be guaranteed to work, no matter what.”
Okay, so what is “the necessary trade-off” of that? You guessed it: (1) file size, and (2) memory. But, neither one of these things are (in this case...) judged to be important. Quite the opposite ... they are sacrificial. They are “the price to be paid.”
| |