Memory Leak with my Ray-Tracing plugin

Hello, I am having a problem with my ray tracing plugin. I had encountered the problem weeks from now, however, to that time I just ignored it as other stuff was more important. Anyway, now that I am looking towards to the release of the plugin I want to give the Users a good experience while using it.
The only thing is that the Ray-Tracing plugin I’ve made has a huge memory leak.

  1. What do you want to achieve? Keep it simple and clear!
    (Re-) rendering bigger scenes without studio crashing due to bad allocation (no RAM).

  2. What is the issue? Include screenshots / videos if possible!
    Whenever I rerender a scene, the memory used for the previous render is not garbage-collected. Meaning that just piling up. I am using Frames to draw the image produced by the Ray-Tracing algorithm. Whenever a new render starts, all those previous frames (up to 6k) get removed (They are parented to a folder, I use the :ClearAllChildren() method to remove all frames), it removes the frame but does not free the used memory.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Changing :ClearAllChildren() to :Destory() and :Remove()-method.

I have no idea why that is, I think it has to do with how roblox studio handles the collection of garbage on plugins.

Any help is appriciated!

2 Likes

I’ve seen games delete map models one-by-one, not plainly deleting them. Try deleting parts with a 0.2 delay

.2 second delay would be a bit much considering there are thousands of frames per render. Even with .002 it could take up to 12 seconds just to clear the previous render. I dont think that this solution would fit the plugin’s later Market.
Maybe waiting after every 100 frames or so, but it would still be a bit bulky for the user.

Thank you for the suggestion tho.