help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] OOP leaking with registered object


From: Paolo Bonzini
Subject: Re: [Help-smalltalk] OOP leaking with registered object
Date: Fri, 03 Apr 2015 22:24:53 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0


On 03/04/2015 21:30, Roland Plüss wrote:
> I'm trying to figure out why I've got a leak with GST. It's about a
> C++ program hosting smalltalk as script language. Let's say you've
> got this scenario:
> 
> class Something: OOP app Init(): gst_initialize( NULL, NULL,
> GST_NO_TTY ) // add classes and stuff app = gst_perform( classApp,
> selectorNew ) // calls also init gst_register_oop( app ); 
> CleanUp(): app = gst_perform( classApp, selectorCleanup ) // calls
> cleanup gst_unregister_oop( app ); // clean up classes and stugg 
> gst_invoke_hook( GST_ABOUT_TO_QUIT )
> 
> Furthermore let's say a smalltalk script does something simple like
> this: MyApp subclass: App [ | x | init [ x := CEnabledClass new ] 
> cleanup [ x := nil ]
> 
> No other object stores a reference to x for this simple test. Now x
> is always leaking. Furthermore OOP app is leaking (if I set it to
> call finalize and printf on finalize[] nothing happens).
> 
> I can verify that if X is created somewhere in smalltalk function
> and going out of scope it is properly destroyed if not used and
> does not leak.
> 
> If assigned to OOP app x leaks because OOP app is not freed. Most 
> probably OOP app is simply not garbage collected in that short
> time?
> 
> Is there a way to force garbage collection before shutting down?

You can call "ObjectMemory globalGarbageCollect".

If you want finalization (I assume you do, because otherwise the leak
is harmless), then even that is probably not enough, because
finalization is done asynchronously after GC finishes.  Why do you
absolutely need to finalize app?  What resources does it hold?

Paolo

> 
> 
> 
> _______________________________________________ help-smalltalk
> mailing list address@hidden 
> https://lists.gnu.org/mailman/listinfo/help-smalltalk
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]