[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Does dropping objects really free memory?
From: |
famasce |
Subject: |
Re: Does dropping objects really free memory? |
Date: |
Wed, 20 Oct 1999 10:58:44 +0200 |
> One thing is this:
>
> diff --ignore-all-space -c -r fabio-orig/Agent.m fabio/Agent.m
> *** fabio-orig/Agent.m Tue Oct 19 10:24:32 1999
> --- fabio/Agent.m Tue Oct 19 19:30:46 1999
> ***************
> *** 572,578 ****
> [curPopArray drop];
> [selectArray drop];
>
> ! return [partial_Best copy:[self getZone]];
> }
The object partial_Best is stored in 'theZone'.I've to make a copy of it in
the Agent's zone, otherwise real_Best will point to something that will be
dropped later.
However there's an error: every time 'selctBestMessage' is called the old
storage pointed by real_Best becomes garbage and it's not freed.
> --- 571,577 ----
> [curPopArray drop];
> [selectArray drop];
>
> ! return [partial_Best copy: theZone];
> }
>
For what I've said before, this gives an STATUS_ACCESS_VIOLATION, because it
assigns to real_Best a pointer to something that will later be dropped.
> You also have various usages of calloc that you aren't handling in drop
> methods. I suppose you already know that Zones are just a higher level
> abstraction on top of malloc routines...
>
ehmm..!
Isn't 'calloc' that from the C <malloc.h>, and isn't it enough to call
'free' on the dinamically allocated storage?
==================================
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.
Re: Does dropping objects really free memory?, Marcus G. Daniels, 1999/10/19
Re: Does dropping objects really free memory?,
famasce <=