On 15 Jul 2010, at 14:45, Mariano Martinez Peck wrote:
On Thu, Jul 15, 2010 at 2:42 PM, Rob Withers reefedjib@yahoo.com wrote:
Utilities pointersTo: object
Thanks Rob. But that implementation does a someObject and then loops with nextObject. Thus, it does a full memory scan. I want to avoid that. So the only way is storing somewhere such pointers or at least a counter I think.
If you need it to be accurate and available all time, you will probably need the basic mechanisms of a reference counting GC.
Best regards Stefan
Thanks agian
mariano
http://www.noharmmeansnofoul.org
From: Mariano Martinez Peck Sent: Thursday, July 15, 2010 8:40 AM To: Squeak Development Discussion Virtual Machine Subject: [Vm-dev] Detecting objects that point to an object
Hi folks. I need to know the objects (actually, only how many) that are pointing to any object. So...I take an object X, and I want to know how many objects are pointing to X.
The only possible I see in Squeak VM is to do a full mark over all objects in memory (or starting by the roots). This is time consuming and I even need (maybe) to do this check (to know how many objects are pointing to an object) for every single object.
So...is there a faster solution for this? The only thing I can imagine is to modify the object header, maybe create a new type, and add an array with the addresses of the objects that are pointing to that object. Or maybe just a counter that I can increase or decrease ?
Thanks for any tip.
Mariano