- Home /
Need to use HDD instead of RAM
Hello guys,
I am using a recursive code with many cycles (7m +) in the Editor mode. The thing is, if I go beyond that, I am running out of memory. After having done some research, apparently there is a way around this, by using the HDD space temporary, saving and obtaining information for my recursion somehow.
Please point me in the direction, where I can learn how to use this strategy with .Net and Mono.
Thank you very much!
Answer by HappyMoo · Jan 05, 2014 at 05:41 PM
Well... first you probably want to turn your recursive algorithm into an iterative one by using a stack:
http://stackoverflow.com/questions/159590/way-to-go-from-recursion-to-iteration
Then maybe it already works, because you actually just hat a stack overflow and not really no more memory.
If you actually run out of heap memory, you can try to temporarily save some of your stuff to HDD if it makes sense for your algorithm. It doesn't make sense if you need to access all the data all the time, because then putting it on HDD and getting it out 100ms later will kill your performance.
Thank you Happy $$anonymous$$oo, I was about to add that I've found something similar :D http://stackoverflow.com/questions/1549943/design-patterns-for-converting-recursive-algorithms-to-iterative-ones Going to look at it in-depth now.
Do you know any of the articles to learn how to use HDD with $$anonymous$$ono and .Net?
Thank you :)
Using HDD... sure this simply means writing files. Everything you need is in the System.IO Namespace
Google "How to write files in C#" for starters, then look here:
Your answer
Follow this Question
Related Questions
Why does Unity crash? (and other programs in general) 1 Answer
How to increase the Call Stack Size in Unity? 0 Answers
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers