[VPM] module memory leak

abez abez at abez.ca
Sat Jan 22 14:17:07 PST 2005


The call
>           Win32::IPHelper::AllocateAndGetUdpExTableFromStack( 
> \@PROCUDP_EX_TABLE,
>             $bOrder );

has the word allocate in it even tho it says fromstack. You might be
losing memory then by not deallocating.

More importantly tho you never pop @PP, it keeps growing in size. So you
will be allocating more memory for @PP all the time.

abram


On Fri, 21 Jan 2005, Jeremy Aiyadurai wrote:

> hi all,
> 
> i am using a module called Win32::IPHelper.
> I call two of its functions inside an infinite loop, (yes it needs to be 
> infinite).
> 
> The program eats memory fast, between 4 and 15 KB / sec
> 
> What can i do so it does not eat memory like this? The problem does not seem 
> to be my code,
> I think it is the module.
> 
> Thanks in advance for any help.
> 
> -Jeremy A.
> 
> below is the program to test for yourself.
> -------
> use Win32::IPHelper;
> 
> sub portprocloop {
> 
> 
>     my @cp;
>     my @PROCUDP_EX_TABLE;
>     my @PROCTCP_EX_TABLE;
> 		my @PP;
> 
>     while (1) {
> 
>         @PROCUDP_EX_TABLE = (-1);
>         @PROCTCP_EX_TABLE = (-1);
>         @PP = (-1);
> 
>         $ret =
>           Win32::IPHelper::AllocateAndGetUdpExTableFromStack( 
> \@PROCUDP_EX_TABLE,
>             $bOrder );
> 
>         $ret =
>           Win32::IPHelper::AllocateAndGetTcpExTableFromStack( 
> \@PROCTCP_EX_TABLE,
>             $bOrder );
> 
> 				push(@PP, at PROCUDP_EX_TABLE);
> 				push(@PP, at PROCTCP_EX_TABLE);
> 
>             foreach (@PP) {
> 
> 	#print $_->{ProcessId},",",$_->{LocalPort},"\n";
> 
>                 }
>         Win32::Sleep(200);
>     }
> 
> }
> 
> 
> 
> portprocloop();
> 
> 
> _______________________________________________
> Victoria-pm mailing list
> Victoria-pm at pm.org
> http://mail.pm.org/mailman/listinfo/victoria-pm
> 

-- 
abez ------------------------------------------
http://www.abez.ca/ Abram Hindle (abez at abez.ca)
------------------------------------------ abez



More information about the Victoria-pm mailing list