Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
Problems? Is your data what you think it is?
 
PerlMonks  

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

Comment on Allocation of anonymous variables
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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://567849]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (13)
As of 2014-04-23 18:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (552 votes), past polls