swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Memory confusion


From: Jason Bobbin
Subject: Memory confusion
Date: Wed, 22 Mar 2000 12:21:04 +1030

Does [aZone drop] release all allocated memory?? The docs say so, but
the included code appears, at least on Linux under top, to not
deallocate the memory. This was playing havoc with my algorithm! So what
have I done wrong? 

If I need to use [aZone freeBlock: aNum blockSize: sizeof(double)] in my
simulation I will have problems because I don't know whether aZone has
already been dropped - if it has how can I free the allocation? Do I
need to freeBlock: before dropping all problem zones?

Jason.

PS I'm using swarm 2.1
_____________________________ 

#import <objectbase/SwarmObject.h>
#import <simtools.h>

int main (int argc, const char **argv)
{ 
id <Zone> aZone;
double *aNum;

initSwarm (argc, argv);

while(1==1){
aZone = [Zone create: globalZone];
aNum = (double *) [aZone allocBlock: sizeof(double)];
//printf("%p \n",aNum);
[aZone drop];
}

}

-- 
Jason Bobbin                 Phone: ++61 (0)8 83037284
Dept. of Soil and Water      Fax:   ++61 (0)8 83036511 
The University of Adelaide   Email: address@hidden
Glen Osmond, SA              URL: http://jbobbin.waite.adelaide.edu.au

                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]