🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

GarbageCollect(asGC_FULL_CYCLE | asGC_DESTROY_GARBAGE)

Started by
0 comments, last by WitchLord 10 years, 3 months ago

I am having issues that none have been able to help me with. I am trying to resolve an issue with my warsow server crashing.

I'm using angel script to create a mod. the games play well but during game changes when variables and classes are being reset it is crashing.

it seems to relate to memory, and how many clients are in the game.

I saw this topic: GarbageCollect(asGC_FULL_CYCLE | asGC_DESTROY_GARBAGE) or command line listed but was not sure exactly how to use it, or if i even could use it. Any insight on this or how I might possible add something to my class destructors to help with this problem would be greatly appreciated.

Thanks in advance for you input.

Bjorn.

Advertisement

GarbageCollect(asGC_FULL_CYCLE | asGC_DESTROY_GARBAGE) would do a complete cycle to destroy all known garbage (i.e. objects in the garbage collector that has reached refCount == 1). It would not attempt to detect garbage that might be hidden due to cyclic references.

To detect and destroy garbage that is kept alive due to cyclic references you would need to use the flag asGC_DETECT_GARBAGE too. The default argument to the GarbageCollect does just that, so if your intention is to find and destroy all garbage, then you can call the method without any arguments.

What can you tell us about the server crash? Do you think it crashes due to consuming too much memory? Or do you think it crashes due to some memory corruption? Can you show us the call stack for where the crash occurs?

What OS is your server running on? Is it Linux? 32bit or 64bit? What version of AngelScript are you using?

If you suspect the problem has to do with the garbage collection, then I suggest you implement a routine to gather some information from the garbage collector throughout the execution. The method GetGCStatistics provides information on how many objects are known to the garbage collector, and how many it destroys, as well as how many circular references it detects and breaks throughout the execution. If you need to inspect individual objects, you can get the address of the object with GetObjectInGC. This method also gives you a sequence number which will give you an idea of how long the object has been in the garbage collector. This same sequence number was returned by NotifyGarbageCollectorOfNewObject, so if you suspect a specific object is causing the problem and can reproduce the exact same scenario repeatedly, then you can set a break point on this call to determine where the object was originally created.

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

This topic is closed to new replies.

Advertisement