When exactly an object gets deleted from the system ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

When exactly an object gets deleted from the system ?

kilon.alios
I am wondering when an instance of a class is garbage collected and deleted from the system.

is there a way to manually deleted it ?
Reply | Threaded
Open this post in threaded view
|

Re: When exactly an object gets deleted from the system ?

EstebanLM
Hi,

> On 30 Nov 2015, at 11:40, Dimitris Chloupis <[hidden email]> wrote:
>
> I am wondering when an instance of a class is garbage collected and deleted from the system.
>
> is there a way to manually deleted it ?

no, that beats the purpose of a garbage collector.
but… it should be cleaned quite fast, if it is not, most probably you are keeping a reference somewhere.

Esteban


Reply | Threaded
Open this post in threaded view
|

Re: When exactly an object gets deleted from the system ?

CyrilFerlicot
In reply to this post by kilon.alios
Le 30/11/2015 11:40, Dimitris Chloupis a écrit :
> I am wondering when an instance of a class is garbage collected and
> deleted from the system.
>
> is there a way to manually deleted it ?

If there is no Object that reference your object you can force a Garbage
collect with "Smalltalk garbageCollect". If your object is still here
you can try to see what point to it with "(X allInstances collectAsSet:
#pointersTo) inspect".

When the reference is spotted you can try to remove it then garbage
collect again.

--
Cyril Ferlicot

http://www.synectique.eu

165 Avenue Bretagne
Lille 59000 France


signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: When exactly an object gets deleted from the system ?

EstebanLM

> On 30 Nov 2015, at 11:55, Ferlicot D. Cyril <[hidden email]> wrote:
>
> Le 30/11/2015 11:40, Dimitris Chloupis a écrit :
>> I am wondering when an instance of a class is garbage collected and
>> deleted from the system.
>>
>> is there a way to manually deleted it ?
>
> If there is no Object that reference your object you can force a Garbage
> collect with "Smalltalk garbageCollect". If your object is still here
> you can try to see what point to it with "(X allInstances collectAsSet:
> #pointersTo) inspect".
>
> When the reference is spotted you can try to remove it then garbage
> collect again.

forcing a garbage collection is not a recommended procedure. Of course you can do it while testing/developing/etc., but you must not use it as a part of your code :)

Esteban

>
> --
> Cyril Ferlicot
>
> http://www.synectique.eu
>
> 165 Avenue Bretagne
> Lille 59000 France
>


Reply | Threaded
Open this post in threaded view
|

Re: When exactly an object gets deleted from the system ?

kilon.alios
In reply to this post by CyrilFerlicot
and of course you are both correct , I have a circular reference, basically an object A referencing  object  B  which references object A. No wonder why is not gc. Thanks for helping me out spotting this.

On Mon, Nov 30, 2015 at 12:56 PM Ferlicot D. Cyril <[hidden email]> wrote:
Le 30/11/2015 11:40, Dimitris Chloupis a écrit :
> I am wondering when an instance of a class is garbage collected and
> deleted from the system.
>
> is there a way to manually deleted it ?

If there is no Object that reference your object you can force a Garbage
collect with "Smalltalk garbageCollect". If your object is still here
you can try to see what point to it with "(X allInstances collectAsSet:
#pointersTo) inspect".

When the reference is spotted you can try to remove it then garbage
collect again.

--
Cyril Ferlicot

http://www.synectique.eu

165 Avenue Bretagne
Lille 59000 France

Reply | Threaded
Open this post in threaded view
|

Re: When exactly an object gets deleted from the system ?

stepharo
GC handles circular dependencies. So you should have an extra pointer pointing to one of your circular elements.

Le 30/11/15 12:22, Dimitris Chloupis a écrit :
and of course you are both correct , I have a circular reference, basically an object A referencing  object  B  which references object A. No wonder why is not gc. Thanks for helping me out spotting this.

On Mon, Nov 30, 2015 at 12:56 PM Ferlicot D. Cyril <[hidden email]> wrote:
Le 30/11/2015 11:40, Dimitris Chloupis a écrit :
> I am wondering when an instance of a class is garbage collected and
> deleted from the system.
>
> is there a way to manually deleted it ?

If there is no Object that reference your object you can force a Garbage
collect with "Smalltalk garbageCollect". If your object is still here
you can try to see what point to it with "(X allInstances collectAsSet:
#pointersTo) inspect".

When the reference is spotted you can try to remove it then garbage
collect again.

--
Cyril Ferlicot

http://www.synectique.eu

165 Avenue Bretagne
Lille 59000 France