It can happen that there are so many strategies that they crash the program.
We should check if there is at least 10% of free memory, and if not then don't create a new ResultsGroup or stop build process.
- In strategy loader before Resultsgroup is created - make a check, and if it fails throw an exception and don't load the strategy. Stop also loading other strategies if it is mass load.
- in Builder/Retester/Optimizer - check this everytime when strategy is saved into databank. If it fails don't add strategy and stop the project.
To get memory usage use: MemoryUsage.getMax(),getUsed()
Experiment with 10% boundary - if it is enough. Maybe it should be 15%, or some exact amount in MBs.