ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl5-porters
perl5-porters
Memory allocation in 5.6
by Marc D. Spencer other posts by this author
Sep 28 2000 9:12PM messages near this date
[PATCH 5.7.0] Minor optimization in re_intuit_start | Re: Memory allocation in 5.6
I'm totally at a loss;

Can someone explain the following:

This code:
-----
#!/usr/local/bin/perl

use bytes;

my $foo = 'x' x ($ARGV[0] * 1024000);

sleep $ARGV[1] if $ARGV[1];
print "Released.\n";
-----

Before:

marcs [~]>  free
              total       used       free     shared    buffers     cached
Mem:        517120      71032     446088      17368      10552       9788
-/+ buffers/cache:      50692     466428
Swap:      1052216      55784     996432

During run: (with $ARGV[0] = 100)

marcs [~]>  free
              total       used       free     shared    buffers     cached
Mem:        517120     272200     244920      18552      10688      10188
-/+ buffers/cache:     251324     265796
Swap:      1052216      55784     996432


seems to allocate twice the memory I ask it for. This wouldn't be a 
problem, except I'm manipulating images in scalars, so they can be 
large.


Any thoughts?
Thread:
Marc D. Spencer
Yitzchak Scott-Thoennes

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved