#98605 - yal - Wed Aug 16, 2006 11:00 am
Hi,
I got some weird problems using DevKitPro with libnds. I'm new to Ds programming, so hopefully I'm missing something obvious and you'll be able to help me :)
I have a class like that :
CNdsApp is instantiate with a new in the main function of the Arm9 at application start-up, and the class CBoard is instantiate the same way in the Init function of CApp (called right after the new)
On run-time I got an exception that seem to happen on the second new (I only got 2 new in my application) : st9bad_alloc.
The weird thing is that the exception doesn't happen if I move my two first int of CNdsApp (x and y) at the bottom of the class (every other emplacement make the application crash). My first though was memory alignment problem, but my class contain only 32 bit, so I don't see how that could cause memory alignment issue.
I don't think it's because I run out of memory either since I allocate only those two little classes.
Any idea?
I got some weird problems using DevKitPro with libnds. I'm new to Ds programming, so hopefully I'm missing something obvious and you'll be able to help me :)
I have a class like that :
Code: |
class CApp { virtual void Init(); ... Some other function here ... CBoard * m_pBoard; }; class CNdsApp : public CApp { ... Some Function here ... int x; int y; int m_bPreviouslyTouching; unsigned short * m_pMap; int m_iBoardOffsetX; //Offset in tiles int m_iBoardOffsetY; //Offset in tiles }; class CBoard { ... some function ... struct SBox { EBoxContent Content; bool aNeighbors[4]; }; SBox m_Board[BOARD_SIZE_X][BOARD_SIZE_Y]; }; |
CNdsApp is instantiate with a new in the main function of the Arm9 at application start-up, and the class CBoard is instantiate the same way in the Init function of CApp (called right after the new)
On run-time I got an exception that seem to happen on the second new (I only got 2 new in my application) : st9bad_alloc.
The weird thing is that the exception doesn't happen if I move my two first int of CNdsApp (x and y) at the bottom of the class (every other emplacement make the application crash). My first though was memory alignment problem, but my class contain only 32 bit, so I don't see how that could cause memory alignment issue.
I don't think it's because I run out of memory either since I allocate only those two little classes.
Any idea?