c++ - Barnes-Hut and recursion limit -


i have implemented "barnes-hut" algorithm n-body simulator, , have run problem.

my program crash, memory related exceptions, stack overflow exception.

the thing makes strange error receive not occur @ fixed times, seems come out of blue. using task manager can see there no memory leak, , have been careful avoid this. though, use recursion, , objects in objects.

is possible need include maximum depth of oct-tree , causing error?

the maximal recursion depth indeed limited stack size.
stack size not same full ram memory size.
eg. on windows, default stack size (per thread) 1mb, nothing more.

it´s possible reconfigure program, and/or "catch" stack overflow error without whole program crashing (latter rather dirty, @ least possible).

nonetheless best solution modified code rid of recursion. recursions can replaced iterative solutions, bit more complicated. , data of each function call can moved vector etc. 1 entry per call, dynamic allocated vector memory can use whole ram.


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -