• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Garbage collection / data flushing / mem leak issues

S

SexySicilianSoprano

Guest
Aloha snackbar, fellow GManiacs.

I've got a few questions about carbage collection and data flushing. I am aware that user-made data structures must be deleted manually, which I am currently doing, but I'm facing some problems. We've made a procedural generation that generates creates new rooms from binary files and a new floor pattern for the rooms each time a certain type of room is reached within the game. I have a script that's supposed to flush each and every list and map I have used in generation before starting a new generation.

Still, the game is leaking memory pretty badly. It is also supposed to clear a lot of objects, a few lists and other stuff every time I exit a room. I call "with(objectname) instance_destroy;" on a lot of things. This, however, doesn't seem to do much.

What I wish to know is that does ds_list_destroy also destroy all the data it references or does it only destroy the references to them? Is there a way to destroy old rooms the player cannot and should not access anymore? How exactly does GM:S's garbage collection work, is there something I've failed to understand? I've tried googling a lot, but can't seem to find information that relates to my problems.

I'm also facing another specific issue, possibly related to memory leaking: our main character has this scarf that follows behind him. Almost every time the debugger memory graph goes over 40MB, the scarf's components are destroyed. After that they're destroyed more frequently (I destroy and recreate the scarf every time the player enters the room to prevent a lot of strange 💩💩💩💩-ups because math n stuff), pretty much every time a lot of enemies die at the same time. I tagged all places that called for scarf's instance_destroy(), but each time it happened, it wasn't either of them.

Some extra information: we have an object-based custom particle system, that creates particles with physics so that they may interact with the room ie. blood splattering stays on walls. The blood effect is called every time an enemy dies, the particles are destroyed within some seconds and they're supposed to be flushed every time the player exits the room.

It's a lot of text, I know, but bear with me. If you need to know more of our engine, I'll be happy to oblige if it means we can get our stuff fixed as soon as possible.

Thanks in advance!
 
T

ThunkGames

Guest
What I wish to know is that does ds_list_destroy also destroy all the data it references or does it only destroy the references to them?
Do you mean does it destroy data structures within it? The answer is no. For example:
Code:
var ls1 = ds_list_create();
ds_list_add(ls1, ds_list_create());
ds_list_destroy(ls1);
In the example above, the list within ls1 is never destroyed. To make matters worse, there is no way to find out this list's reference and destroy it (the reference only existed a sthe single value in ls1).
 
Top