Smalltalk memoryHogs

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

Smalltalk memoryHogs

Igor Stasenko
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.

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project