Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Best way to allocate some memory first

by LanX (Sage)
on Dec 02, 2021 at 22:53 UTC ( #11139340=note: print w/replies, xml ) Need Help??


in reply to Best way to allocate some memory first

Why?

> firstly array max is 40 - 41 KB which is pushed beyond then

I doubt you measured it right, but $#array=40000 will expand an empty @array to 40001 slots. (well actually even more).

But I doubt it'll allocate space for the included scalars ...(?)

update

see also https://stackoverflow.com/questions/36775922/what-is-the-use-of-preallocating-memory-for-an-array-in-perl

40 KB doesn't qualify as "large" in my book.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2022-05-24 19:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (84 votes). Check out past polls.

    Notices?