Garbage collects a specific object

Is it possible to garbage collect a specific object in Pharo?

eg. I know that a certain object is not (should not) be referenced by any other object. And it takes up a lot of space. Does it make sense to just run general garbage collection on the system? Or it is possible to remove from the heap only a specific object / tree

+3


source to share


3 answers


No, it doesn't make sense and it is impossible.

It also doesn't make sense to manually start the garbage collector (which you can of course do) ... the system has to run gc when needed and you get that space back.



The whole purpose of gc is that you don't have to worry about it.

+2


source


Smalltalk garbage collectors cannot collect garbage for just one object.

There are two main methods used: cleanup generation and marking and sweeping. Generation scrapping works on new and relatively new objects by copying used objects to another unused space and ignoring all garbage. Objects that are copied many times are moved to "old space". Old space is garbage collected with a mark and sweep algorithm. This algorithm traverses all Smalltalk objects and marks them as "untagged". Then it goes through all the available objects and marks them as "marked". In the final scan, anything that is marked as "unmarked" is released.



It is not possible to run any algorithm on one object.

+5


source


I think you are looking for a list of links.

(i.e. which object your object is holding, not garbage collection).

There may be some kind of global variable. Something in a class variable ...

0


source







All Articles