gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > DS Memory problems

#75057 - pettersson - Thu Mar 09, 2006 9:43 pm

Hi,

i'm using devkitarm r17 and have encountered some problems regaring memory on ds (arm9)
if i set a static array (like char a[1000]) application just crashes.
otherwise, if i try it dynamically (using malloc) i always get a null pointer as a result from malloc (doesn't matter how small the blocks are).
even a 2 byte allocation just returned a null pointer.
i already tried a different arm9 linker script (the one i found on the forums), but no difference...

thx for help...

#75103 - HyperHacker - Fri Mar 10, 2006 3:36 am

Making a local array too big will cause a stack overflow. (I noticed this when making a 4MB local array on Windows. Boom! :-p) I've also had a bit of trouble with malloc and related operations on DS; malloc sometimes fails for no apparent reason, and some of the info returned by mallinfo is wrong (very small amount of free space that actually goes up as I use more).

#75109 - genfish - Fri Mar 10, 2006 4:08 am

i use new and delete in c++ and i've not had any problems yet, sometimes storing huge images in arrays of unsigned shorts too.
_________________
there is no rl only afk

#75118 - pettersson - Fri Mar 10, 2006 6:36 am

using new and delete results in crashing the application. even when allocating small buffer (~10-20kb)

#75119 - knight0fdragon - Fri Mar 10, 2006 6:41 am

well what are u using C or C++ for this anyway, because ive allocated arrays of 10000 without any problem
_________________
http://www.myspace.com/knight0fdragonds

MK DS FC: Dragon 330772 075464
AC WW FC: Anthony SamsClub 1933-3433-9458
MPFH: Dragon 0215 4231 1206

#75168 - pettersson - Fri Mar 10, 2006 6:49 pm

i am using C++ and this starts to suck, really :/

#75256 - genfish - Sat Mar 11, 2006 2:54 pm

thats really wierd... post some code so we can have a look
_________________
there is no rl only afk