Do static classes leak memory?
I have made a simple 2d game engine currently built on SDL2 to work on the api and such. What i've noticed is that the game engine is leaking loads of memory (around 2 mb a second) and i'm trying to figure out why. Now the entire game engine is composed of static classes so that you can do calls like
Draw.Rectangle(x, y, w, h)
and likewise to ease the learning curve and Draw.Rectangle adds a class to a list which is drawn and cleared every frame. Do static classes not clear memory or something similar or do i have another problem? I have checked the rider memory debugger and it says that the Rectangle class takes up around 255 kb which should not be happening.6 Replies
Unknown User•16mo ago
Message Not Public
Sign In & Join Server To View
Yeah i 100% thought it was a ref count
My code relies on a list clearing also clearing memory
would there be any recommendation to fix this or is it a case by case basis?
Unknown User•16mo ago
Message Not Public
Sign In & Join Server To View
Yeah i have the code public on github but i don't i can't really share one part of the code since every part calls to another in most cases
It would require someone to understand the code base which i don't really see anyone having the time to do to be frank
Unknown User•16mo ago
Message Not Public
Sign In & Join Server To View
yup i'll check it out probably easier ty for the advice