Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Allocation of anonymous variables

by jkva (Chaplain)
on Aug 17, 2006 at 08:03 UTC ( #567849=perlquestion: print w/replies, xml ) Need Help??
jkva has asked for the wisdom of the Perl Monks concerning the following question:

Good morning Monks,

Purely out of interest : When I create an anonymous variable in Perl, is this variable then allocated on the heap?

Thanks for answering. Apologies to marto for borrowing his introductory message ;-)

-- jkva

Replies are listed 'Best First'.
Re: Allocation of anonymous variables
by jesuashok (Curate) on Aug 17, 2006 at 10:18 UTC
    Hi jkva,

    when you create a anonymous variable, in perl, in turn it behaves like the memory allocation happening in C's malloc function. When the perl interpreter needs some memory, it asks the C runtime library for it, using the malloc(). since, malloca allocates memory in the heap the anonymous variables are allocated int the heap.

    Just to give you more idea, when you consider about memory allocation in all programming languages, you will have to consider the following facts in mind :-

    1. It's important firtst to understand how your OS and libraries handle memory
    1. depending on system ( whether you're on a 32 bit or 64 bit system)

    "Keep pouring your ideas"

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://567849]
Approved by marto
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2018-05-24 03:18 GMT
Find Nodes?
    Voting Booth?