Advertisement

Array not released

Started by September 26, 2014 10:22 AM
10 comments, last by cvet 10 years, 1 month ago


If I disable automatic garbage collection and will not call GC explicitly then array not will be released and all handles in it too.

This is true. In this situation the array will stay alive until you manually call the GC, hence the array will hold on to the reference to the mytype stored in it.


I do not say about destroying, I say about releasing. Because in mytype used 'short' for refCount and I have overflow after some time if GC not invoked (myfunc is called every frame).

Even a short can count up to 32767. If you have that many references to the same object, then you might want to rethink your design.


If you say this is normal behaviour that GC objects can hold not GC objects before GC kill it, then it's ok, I just want point on this behaviour.

Yes, it is normal for GC objects to hold non-GC objects. AngelScript has no way of knowing that mytype cannot be derived from and thus cannot form a circular reference.

I already have plans of adding an extra flag to allow the application to tell AngelScript that a registered type cannot under any circumstances form a circular reference. The CScriptArray and other classes will then not have to garbage collected just because they can contain a handle to this type.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Even a short can count up to 32767. If you have that many references to the same object, then you might want to rethink your design.

Nothing to do with design.

If I switch off FPS limiter then my application get ~700 FPS, and it reach 32767 just for 46 seconds. As I say before myfunc invoked every frame.

For now I switch application to built-in automatic garbage collector, because our manual works not good as I see.

This topic is closed to new replies.

Advertisement