Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re: Huge perl binary file

by dave_the_m (Prior)
on Jul 13, 2012 at 09:51 UTC ( #981590=note: print w/ replies, xml ) Need Help??

in reply to Huge perl binary file

None of the comments so far have made it clear that the thing being dynamically loaded is the perl library itself; i.e. the 16K thing is just a little wrapper that calls perl library routines to create, execute and destroy a perl interpreter. The vast bulk of the code for the perl interpreter resides in, which may or may not be statically linked into the perl executable.


Comment on Re: Huge perl binary file
Replies are listed 'Best First'.
Re^2: Huge perl binary file
by davido (Archbishop) on Jul 13, 2012 at 22:31 UTC

    This is a nice explanation. The perl executable is really just a specific use case of what is documented in perlembed. In this case, Perl is embedded in perl. How it's linked is what is in question; static versus dynamic. If is not statically linked, it will be pulled in as soon as it's needed. If it's statically linked, it gets included at startup time.

    I don't know enough about the internals to know the answer to the following question, but in practical terms I hardly see how it matters: The question: Which of the following commands from Perl's API results in a dynamically-linked being pulled in: PERL_SYS_INIT3(), perl_alloc(), perl_construct(), perl_parse(), or perl_run()?

    The thing is, I doubt that it matters which one triggers the dynamic loading, because they're probably called in close succession within the perl executable. perlinterp discusses how perlmain.c is really just a concise, high level wrapper around the code that appears in perl.c, and that it looks a lot like the embedding example in perlembed. The little 16k wrapper doesn't maintain its slender memory footprint for very long. Certainly by the time Perl begins parsing code it has already found a need that requires pulling in is probably loaded (under a non-static link build) before you have time to sneeze, relegating the distinction between start-up time for static vs dynamic linking to the dustbin of micro-optimization.


      I would expect to get linked in when the perl executable is first loaded, and before any functions are called: the loading isn't triggered by calling a particular function. Of course, this is OS specific.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://981590]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2015-11-29 05:01 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (746 votes), past polls