my work image grown to 80Mb in size.. and i start growing suspicious about myself for forming a resource leak somewhere..
But as it appears, it is because of Nautilus.
During my experiments with ObjC wrapper for NativeBoost,
i used nautilus for showing more than 4000 Objective-C classes in browser..
Since all those objects are actually wrappers, they generated each
time when i open a new browser window..
to explore an obj-c universe and to test bugs..
So i ended up with:
ObjCClassWrapper allInstances size 31885
Now, about why cache doesn't cleaning up automatically:
The only reference coming to particular instance of ObjC wrapper is
from a ClassesIconCache class var,
which is a weak key dictionary:
{my class wrapper} -> [IconicButtonStateHolder]
so, a {wrapper} is held weakly here, of course, while [its Icon]
strongly, and so far so good.
But the problem is that , [IconicButtonStateHolder]
having following in it's arguments ivar:
an Array(an ObjCClassWrapper), which is [my class wrapper], held strongly.
of course, there is no way how it can disappear from system..
After doing "AbstractNautilusUI resetIconCaches" my image shrunk from
83Mb down to 43Mb,
But i found that i still having a lot of ObjCClassWrapper hanging
around and wonder why..
And this time, because one of the wrapper classes were held in
HistoryCollection via Nautilus 'RecentClasses' classvar.
I think, history should not keep a live object references.. but
instead use symbolic names to refer to the target,
because apparently you cannot go and browse the method/class if you
deleted it from a system.
So, after nilling out that class var, my image lost another 10Mb, down to 33Mb..
and Ben, you owe me a ... (o shit i don't drink beer ) oh ok.. you owe
me 2 bug fixes in Nautilus :)
P.S. i modified a pointer explorer to show only strong references to object(s),
because weak ones are completely useless for fighting with resource
leak problems and only add noise.
With this change a lists produced by pointer explorer are much shorter
and going straight to the point.
So, i attaching .cs to the mail.. in case if someone find it useful.
--
Best regards,
Igor Stasenko.
points-only-weakly.cs
Description: Binary data
