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

  1. WS private: 2,200k ## This is exclusive to this process
  2. WS shareable: 3,392k ## The rest (2,200 + 3,392 = 5,592) can be shared with other processes.
  3. 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.
RIP an inspiration; A true Folk's Guy

In reply to Re: PerlApp (v.7) sharing perl58.dll by BrowserUk
in thread PerlApp (v.7) sharing perl58.dll by fanticla

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.