Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Memory leak

A topic by JamJamTeam created Sep 01, 2020 Views: 495 Replies: 7
Viewing posts 1 to 2

Hi! I think there might be a memory leak in the new update . When I build my project with it, it crashes    after some time (just closes without a code error. I just got an error once in debug mode and it sayd "memory allocation failed").    I used the function  window_set_cursor_sprite()  and when I comment the line out the bug does not occur.. It's not easy to reproduce though since it can sometime take minutes to crash. 

Developer

I'll need a sample project that reproduces this - on the test project, I can call window_set_cursor_surface thousands of times per step and this does not cause any memory increase.

(3 edits)

Ok, here is my project:   ---    I think this might crash faster because I'm already using a lot of memory and texture memory. The function is in the object "osMain" step event line 1957. When it's active and the game is started it sometimes takes seconds and sometimes minutes to crash. When it's commented out it hasn't crashed yet. The debuggers graphs do not show constant increase of memory usage wich is strange because I got  the memory allocation error    but it sometimes does some big jumps up and down when I'm changing cursors fast.  Maybe it's  a problem with texture memory then idk?


Oh and there is anoter bug with this extension and gmlive where it shows an error in the console when I try to reload an event with that function: [live][02.09.2020 10:52:26] Runtime error: [error] `instance#100000(osMain)` (osMain) does not have a variable `window_set_cursor_sprite`


Please tell me when you downloaded it, then I'll delete the link

Developer

Downloaded; I'll look into this. Calling extension functions from GMLive can be problematic, as per documentation.

ok, thank you

Developer (1 edit)

So far I was only able to get this error, which is "breakpoint triggered" originating from GameMaker code and going into a Windows DLL. The error does not come from the cursor DLL as such (you can verify by adding show_debug_message before/after window_set_cursor_* call).


It is unclear as to what does "HEAP: Free Heap block %p modified at %p after it was freed" have to do with changing a cursor, but if you can figure out a more reliable way to reproduce this (perhaps the order of changing cursors..? Or an interaction between using buffers/surfaces with some other GM functions), I could debug this better or send YYG a bug report.

Ok, this dll error is beyond my programming capabilities. But I managed to recreate the crash in a blank project (should have made this earlier, sry :/) where I randomly switch between 3 cursors every frame. Here is the project link: https://we.tl/t-icLAzvuNz5. Unfortunately it can again take some time until it crashes. But it at least eliminates the possibility to have something todo with my surface/buffer shenanigans.

Developer

Downloaded; I DM-ed you an updated DLL with a possible fix on Discord, have you tried that?