Hi all. I have a reasonable large application, that runs under Mod-perl on Apache2.
Here I try to preload the modules, so they are loaded into the primary process of Apache. However, after a few requests, all the precompiled modules use about 60 megabytes of memory (15 mb per process), and it seems that each apache-child is having it's own set compiled.
Is there a way to let mod-perl share it's compiled modules from the main proces?

Next i tried to have only the most-usedmodules loaded, and cached by mod-perl, and the less used (and bigger) modules compiled run-time.

I tried to remove the namespace by
undef(%INC{modulename}),
used 'no modulename' and
do ('module.pm'), however the apache::status still tells me that the modules remain loaded.

Is there a way to let mod-perl load a module and free it's memory after use? I know there is the drawback of recompiling it each time we access it, but it is for some bigger and less used modules that i don't want to keep in memory. (ps: i don't want to run them in a non-modperl environment) The preferred solution would be to have the compiled modules shared (so the total application would take about 15 mb at the first startup of apache), but keeps the rest for the server (and application itself). Thanks in advance, Justus Brugman

In reply to (shared) memory and preloading modules using Mod-perl by jbrugger

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.