Help with GCThreadFunc(CThread*)

FrostyCat

Redemption Seeker
That is a crash from within the garbage collector, which is an engine-level problem that can only be truly resolved by YoYo. If you can replicate the crash in a specific section of your project, report it on the helpdesk, and try temporarily switching off the garbage collector before that point and manually collect later.
 

Mool

Member
Yeah I still wrote them, but I cant reproduce the crash.

Maybe they can tell me what is happening at this point of their code, so I can try to figure it out.
 

FrostyCat

Redemption Seeker
Maybe they can tell me what is happening at this point of their code, so I can try to figure it out.
As I have said before, this point of code is the runner's garbage collector trying to do its work. In a project where it has not been turned off with gc_enable(false);, that point could have been virtually anywhere, though problems typically happen after sections that generate a lot of GC-collectable data (especially arrays and structs).
 

Mool

Member
Yeah I did knew, that GC = Garbage Collection, but I mean maybe I can get more insights what exactly happends at this point "+520"
So I may can find the problem by myself.

I tried to turn it off, but after 5 min my game used ~ 500MB RAM.

Is there a rule to use GC_collect() manually? Can I see anywhere in my GMS game how much RAM is occupied? Should I just do it every minute? Should I do it every room_end() ???

Is there a rule of thumb?
 

chamaeleon

Member
Is there a rule of thumb?
My rule of thumb: Don't turn off the garbage collector.

I realize this is not a solution if the program crashes, but neither is running out of memory. If the GC crashes at all, I would have no confidence whatsoever that it will not crash when one try to manage it manually. It needs to be 100% flawless, given that so many things depend on it that it is practically impossible to avoid relying on it.
 

Mool

Member
Mmh.. ^^

Do you think VM will may fix that issue. Right now I use YYC.
I should test it.
 

chamaeleon

Member
Mmh.. ^^

Do you think VM will may fix that issue. Right now I use YYC.
I should test it.
It is certainly possible that vm execution will not crash while yyc does if there is some memory usage discrepancy between the code present in the VM runner and code that might serve a similar purpose in generated yyc code.
 

Mool

Member
I fixed the garbage collector crashes:

All you need to do is:

1. disable garbage collector
2. do gc_collect() manually all 6 steps, but before u call gc_collect() u need to log gc_get_stats() to see how much garbage exists. !!!!!The goal is to make the garbage small as possible, bacause if there is more work for the garbage collector, then it also means there can be a crash!!!!
3. Startup the debugger and go into a "level" of your game, where a lot is going on.
4. Start the profiler and select bottom up as sorting
5. Look for @@NewGMLArray@@ or other garbage creating things (see @Nocturne post in this thread: https://forum.yoyogames.com/index.p...reference-on-physics-object.79508/post-472667)
--> 6. Now you know which code sections of your game create a lot of garbage, for me it was for example:

STEP Event: variable1 = [abc, def, ghi];

--> I changed it to:
variable1[0] = abc;
variable1[1] = def;
variable1[2] = ghi;

to avoid creating a new GML Array every step.

7. check if your change was fine by checking gc_get_stats(). This should now be smaller (num_objects_in_generation)
 

Mert

Member
I fixed the garbage collector crashes:

All you need to do is:

1. disable garbage collector
2. do gc_collect() manually all 6 steps, but before u call gc_collect() u need to log gc_get_stats() to see how much garbage exists. !!!!!The goal is to make the garbage small as possible, bacause if there is more work for the garbage collector, then it also means there can be a crash!!!!
3. Startup the debugger and go into a "level" of your game, where a lot is going on.
4. Start the profiler and select bottom up as sorting
5. Look for @@NewGMLArray@@ or other garbage creating things (see @Nocturne post in this thread: https://forum.yoyogames.com/index.p...reference-on-physics-object.79508/post-472667)
--> 6. Now you know which code sections of your game create a lot of garbage, for me it was for example:

STEP Event: variable1 = [abc, def, ghi];

--> I changed it to:
variable1[0] = abc;
variable1[1] = def;
variable1[2] = ghi;

to avoid creating a new GML Array every step.

7. check if your change was fine by checking gc_get_stats(). This should now be smaller (num_objects_in_generation)
Just saw your message. LIFESAVER! Danke schön 👊
 
Top