<?xml version="1.0" encoding="windows-1252"?>
<node id="1021384" title="why the perl complied code takes more memory?" created="2013-03-02 00:08:59" updated="2013-03-02 00:08:59">
<type id="115">
perlquestion</type>
<author id="951185">
arunstunner</author>
<data>
<field name="doctext">
Following is a sample code file name is while.pl
&lt;code&gt;
#! /usr/bin/perl
use strict ;
use warnings ;
my $i=0 ;
while (1)
{
print "Testing $i\n" ;
$i++ ;
sleep(1);
}
&lt;/code&gt;
I have compiled this code by using
&lt;code&gt;
perlcc -o compiled while.pl
&lt;/code&gt;

&lt;p&gt;Then I executed the normal code "while.pl" and compiled code "compiled". I seen the memory and cpu usage using the ps command&lt;/p&gt;
&lt;code&gt;
ps axo %cpu,%mem,command | grep "while\|compiled"

0.0  0.0 /usr/bin/perl ./while.pl
0.0  0.1 ./compiled
&lt;/code&gt;
&lt;p&gt;why complied code taking more memory comparing with while.pl?&lt;/p&gt;

&lt;p&gt;How to avoid the memory usage of the compiled perl code?&lt;/p&gt;
</field>
</data>
</node>
