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 > New classes killing the ARM7

#108220 - dak - Mon Nov 06, 2006 8:47 pm

Has anyone else come across this problem (preferably that of which has solved it!). Whenever I instanciate a class in the ARM7 main using the "new" command, all arm7 code seems to simply halt.

-dak

#108234 - tepples - Mon Nov 06, 2006 10:39 pm

Perhaps it's throwing an out-of-memory exception that you're not catching. This is likely given that the standard C++ library appears to take up most of the ARM7's own RAM. What exactly are you trying to do on the ARM7? If you want to use C++ language features to implement object-oriented business logic, then your business logic should run on the ARM9.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#108235 - Lick - Mon Nov 06, 2006 10:42 pm

Yup, better use C or ASM.
_________________
http://licklick.wordpress.com

#108243 - dak - Mon Nov 06, 2006 11:18 pm

As it stands, all other code works just fine otherwise (on the arm7). I remember reading that the arm7 indeed lacks a deal of space, but if I'm instanciating a class with the 'new' command (allocating space on the heap), shouldn't it then reside on main memory (of which there is plenty [yah 4Mb is plenty :D])?

I fear I'm missing an important c++ intricacy.

#108245 - DekuTree64 - Tue Nov 07, 2006 12:20 am

I think ARM9 controls all of main RAM by default, so if ARM7 has a heap at all, it's in the 64KB of IWRAM along with all the code and stuff. Generally it's best to use static allocation on ARM7 so you have more exact control of memory usage. For certain things you could have ARM9 allocate you a lump of main RAM and give you the address by FIFO or some such, but it would be better to avoid doing it routinely.
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku