Page 1 of 1

[NXC] Program crashing. Help!

Posted: 13 Feb 2012, 20:19
by nxtboyiii
Hi,
I was making a game for the NXT (in nxc) and encountered a problem.
When I try to add sound effects in the game, the NXT gets stuck and plays a very soft clicking sound, like when it is in firmware mode.

Why is it doing this?
Thanks,
nxtboy III

Re: [NXC] Program crashing. Help!

Posted: 13 Feb 2012, 20:46
by mcsummation
Standard response #1: Please post your code. ;)

Re: [NXC] Program crashing. Help!

Posted: 13 Feb 2012, 20:49
by afanofosc
It is possible to crash the VM and if your code does that somehow then your brick will click until you pull a battery and put it back in. You may be running out of RAM and the VM is not handling that well. It is hard to be certain without more information but just posting a really large program may not help (too much information). It would be best if you could compare a "works perfectly" version with a "crashes the brick" version and tell us about the changes you made.

John Hansen

Re: [NXC] Program crashing. Help!

Posted: 13 Feb 2012, 21:22
by nxtboyiii
Well, actually, i used the GetMemoryInfo function and saw that the pool size was only around 4500.
So either the function is not working properly or I am doing something wrong with that function, or it is not a RAM problem.

Re: [NXC] Program crashing. Help!

Posted: 13 Feb 2012, 21:47
by mattallen37
Another way of restarting the NXT, that is often easier that pulling a battery, is to press the reset button for a very short time. Holding it for a few seconds will actually reset the NXT, and not just restart it.

Re: [NXC] Program crashing. Help!

Posted: 14 Feb 2012, 23:03
by nxtboyiii
So, what is the problem if the pool size is only about 4,500?

Re: [NXC] Program crashing. Help!

Posted: 15 Feb 2012, 01:47
by afanofosc
There are a lot of ways you can crash the VM. It may not be that you are running out of memory. Go back to the version that worked without crashing and then figure out what changes you made that led to the crashing behavior.

John Hansen