dwjclark11 / Scion2D

2D Game Engine
MIT License
59 stars 8 forks source link

Memory leak during during the font creation/destruction process. #8

Closed 333fps closed 3 months ago

333fps commented 3 months ago

Description Memory leak during during the font creation/destruction process.

Here only 8 bytes (on 64bit machine) will be deallocated because the class does'nt know the size of 96*sizeof(stbtt_bakedchar) but only sizeof(void*) and misses the complete type.

Possible mitigation

etc :)

dwjclark11 commented 3 months ago

@333fps Great catch!

dwjclark11 commented 3 months ago

@333fps Good afternoon, I have been looking into this and I believe that the changes here 8-memory-leak-during-during-the-font-creationdestruction-process should cover this issue. I still want to do some testing to verify.

333fps commented 3 months ago

I Dustin, i think this even eve simpler : https://github.com/333fps/Scion2D/commit/715d921d5038f9eb90947f29dd9260f055b00e0c as only 96 chars are used by the library(which is normal :): image

dwjclark11 commented 3 months ago

@333fps Nice, that is way simpler. We can then just keep the void pointer an convert in the dtor. Great stuff. If you make the PR, I will merge it in. I am going to close the new branch I created today. Thanks.

dwjclark11 commented 3 months ago

@333fps Actually, I already have it open. I can make the change. Thanks a lot.

dwjclark11 commented 3 months ago

Fix has been merged 0931ef3 Thanks.