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 > Memory problems in my current project

#144346 - load*,8,1 - Wed Oct 31, 2007 9:17 pm

Hi everyone!

I'm currently working on porting a SDL-based game to the Nintendo DS. After a couple of days of happy porting I'm now running into some serious memory problems. Under Linux the game uses about 4,5 MB of memory so I think porting should be possible.

1.) It seems like I can only malloc about 2 MB of RAM. I read somewhere that malloc in libnds does not use the whole main memory. How much does it actually use? And is there a way to use all of it?

2.) Could I use VRAM for some data as well? The game does use a great amount of sprites (maybe 1 MB), but they are not the standard console shaped type of sprite. So I'd rather just use VRAM as an extended memory.

#144349 - melw - Wed Oct 31, 2007 9:48 pm

4.5MB sounds like a problem as the console has only 4MB of memory. Rather than using all the memory you can squeeze out, think about loading assets from the flash adapter when needed or using smaller sized/quality graphics/sounds or wherever the most memory is spent. After all the screen resolution isn't huge so people won't notice e.g. smaller sized textures in 3d objects. Same for sounds - the speaker quality is far from perfect and using mono 16khz sounds is still acceptable. Using ADPCM/MP3/OGG may be helpful too.

#144352 - NeX - Wed Oct 31, 2007 10:22 pm

What game are you trying to port?
_________________
Strummer or Drummer?.
Or maybe you would rather play with sand? Sandscape is for you in that case.

#144383 - Mighty Max - Thu Nov 01, 2007 10:34 am

The last 0x1000 Bytes of wram can not be alloced. They are reserved for other purpose (IPC Struct, Slot-1 Header, ExeptionHandler-Pointer)

The most memory that is alloced and not available for your malloc is probably your code. Code and Data share the 4MiB
_________________
GBAMP Multiboot