-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Playdate memory allocator #59
Comments
I started playing around with using the playdate I've got things working on the simulator, but everything immediately crashes when trying to use it on device. Feel free to poke at this and see if it makes sense. |
I thought the What makes you think Nim wasn't using the SDK provided functions? |
This might just be a simulator thing, actually. When I completely comment out all the memory allocation functions in |
Ok, yes seems like compiling for the simulator just uses the std functions no matter what. |
I have to admit to being a bit stumped so far. I’ve tried various compiler and linker flags, but nothing seems to impact the simulator. If you get a chance to look at this, I would love a second set of eyes. |
Since I was stuck, I switched back to working on this branch: https://github.com/Nycto/playdate-nim/tree/memory I got it mostly working, though I still have one workflow failure to investigate. I think this might be the right path forward as it’s the official Nim way to override malloc. I’m going to do some testing this morning to see if it resolves my memory corruption issues |
Hiya!
I've been working on debugging a device-only crash that I think is related to memory corruption. I started a thread about it on the playdate forum here:
https://devforum.play.date/t/device-crash-for-c-nim-based-game/16205
While investigating, I noticed that it doesn't appear that Nim is using the
malloc
implementation provided by the playdate SDK. I tried adding logging into the memory allocating methods insetup.c
from the Playdate SDK and they were never being called. It look like Nim directly callsmalloc
from<stdlib.h>
, as seen here:https://github.com/nim-lang/Nim/blob/version-2-0/lib/system/mm/malloc.nim#L5
Does that sound right? Have you looked into overriding the default Nim malloc implementation to use playdate's realloc? Or have I got this all wrong?
The text was updated successfully, but these errors were encountered: