Forum Discussion
Altera_Forum
Honored Contributor
20 years agostack & heap problem
i am trying to run some recursive factorial program on the nios2 evaluation kit.
The program was cross compiled in the suse linux and was dump into the board, as the value was exceeding 2000 the system is hanging and if the value exceeds 6000 the system is restarting. And for a normal factorial program the system is restarting for 10k integer values(integer value in nios2 is 4bytes). And if the heap i allocated exceeds morethan 1mb it errors as not enough memory. can any one plzz say me what is the problem kindly suggest. thanks & regards srikanth2 Replies
- Altera_Forum
Honored Contributor
There is no virtual memory on nios2.
So the stack is allocated to about 16Kbytes. The recursive calls will surely run out of the stack. Heap allocation is limited to 1Mbytes in kernel config. But there is fragmentation in the memory pool. Read the FAQ on www.ucdot.org. - Altera_Forum
Honored Contributor
check this for stack/heap allocation.
http://forum.niosforum.com/forum/index.php?showtopic=3144 (http://forum.niosforum.com/forum/index.php?showtopic=3144)