i've written a script that generates random german poems from a massive hash/ref-structure imported via Storable. To save the startup-time and lots of mem i converted the script to a mod_perl handler. it compiles and runs fine and initially it shares the complete mem (440 mb) of the apache process but after some runs the size of shared mem rapidly decreases. since i only read from the hash i think the mem gets dirty because of autovivification in the hash. i went over the code and added some exists() but it doesnt seem to change anything. after running for a while there is almost no shared mem left and the mem consumption gets crazy. my questions:
1. it would be very nice for me to declare the whole structure (multi-level/hashs/arrays/refs) read-only but readonly-pragma only supports scalars and i have no idea how to get constants to work with Storable. Anyone got an idea?
2. is there an autoviv of arrays. eg if i have an array with 4 elements and read-access the fifth, is the array changed?
3. is there a write in "foreach $elem (@{$ref})" to $ref?
4. if you are very nice and have absolutely nothing to do, would you throw a look at my source-code (www.versquelle.de, the page is in german but there is a quite understandable link to the source-code in the center of the page) and leave me a mail at info@versquelle.de.
help is very much appreciated.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.