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 > malloc()?

#156914 - thegamefreak0134 - Fri May 16, 2008 12:14 am

Does the DS library have some equivalent of a malloc routine? I'm writing an image editor that loads files from disk, so it makes sense to only allocate the memory that I need, especially if I want to load more than one file at once.

I know the DS is crunchy on memory normally, but it should still theoretically be possible. I can manage if malloc() does, in fact, not exist, but having one there would be handy and make my code a little more portable.

I ask this in advance because I'm setting up the image class for this program on my PC, as it's easier to debug file operations and such on that environment. I just have to be careful and make my code easy to port. ^_^

Thanks!

-thegamefreak0134
_________________
What if the hokey-pokey really is what it's all about?

[url=http:/www.darknovagames.com/index.php?action=recruit&clanid=1]Support Zeta on DarkNova![/url]

#156915 - tepples - Fri May 16, 2008 12:21 am

thegamefreak0134 wrote:
Does the DS library have some equivalent of a malloc routine?

Yes. Newlib has malloc(), and devkitARM on both DS and GBA uses newlib.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#156916 - thegamefreak0134 - Fri May 16, 2008 12:27 am

Neat! Thanks!

TinuDS is one step closer to...no, I'm not going to say it. Bad gamefreak, bad.

-gamefreak
_________________
What if the hokey-pokey really is what it's all about?

[url=http:/www.darknovagames.com/index.php?action=recruit&clanid=1]Support Zeta on DarkNova![/url]