Log In  


I'm working on a sort of roguelike, so using procgen, and I've hit a wall where the game crashes with an "out of memory" error.

Now, since this is still all a WIP I haven't been super careful about memory usage, so it's certainly possible... but when I print the result of stat(0) to the screen, the highest it ever goes is 200 before the crash. Thinking there might be some sort of recursion issue, I logged a couple trace() statements and that turned up a dead end...

Since I don't get a stack trace at the crash, and I have nothing else to go on... My question is: how do I go about troubleshooting this & how do I find the source of the problem? I'm not quite ready to share the cart yet, so I'm less looking for a specific solution and more general guidelines. What should I look for, and where?



The one time I ran into this it was in a place where I was failing to delete stuff from a table that I was repopulating every 10 frames or so. Not sure if it's relevant to your cart, but it did take me awhile to track down before I realized where I went wrong.


that seemed to help! ...a little bit. It's still crashing, occasionally, but less frequently than before. And now I have something to look for, even though it's still not super clear when or why it's running out of memory.

The output of stat(0)... shouldn't it be a lot higher than I'm seeing?


I would expect so, but I'm not at all an expert on the memory side of PICO-8. The only thing I can think is if something is causing a sudden spike before stat(0) prints to the screen, maybe the number is higher than you're seeing. That's 100% speculation though.


In situations like this, I would recommend you to try to comment out parts of the code to nail down which is causing this memory leak. It should be easier to solve once you figured that part out...



[Please log in to post a comment]