[squeak-dev] Smalltalk memoryHogs

Igor Stasenko siguctua at gmail.com
Sat Sep 25 00:40:56 UTC 2010


Just some thoughts...

Magma registers own entities as a memory hog, using (Smalltalk
memoryHogs add: ...)
and then if error happens (because i experimenting with it),
i have a reference handling, and i need to cast weird incarnations to
get rid of it.

What i thinking , that memoryHogs should be not just simple OrderedCollection,
but WeakArray instead.
Then it won't keep hanging references, and don't force to remove them manually.

But the problem is, that its implementation:
memoryHogs
	"Answer the list of objects to notify with #freeSomeSpace if memory gets full."

	^ MemoryHogs ifNil: [MemoryHogs := OrderedCollection new]

means that any user could send #add: or #remove: at any time.
So, i can't replace OrderedCollection with just WeakArray, because it
will break the users of this message. :(

So, i think that memoryHogs should be deprecated and instead, and we
should provide
#registerMemoryHog: and #unregisterMemoryHog
then we are free to use something else than OrderedCollection.


-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Squeak-dev mailing list