Can a Java program detect that it's running low on heap space?

前端 未结 4 2186
故里飘歌
故里飘歌 2021-01-04 12:00

I will be running a genetic algorithm on my roommate\'s computer for the whole weekend, and I\'m afraid that it could run out of memory over such a long run. However, my alg

4条回答
  •  长情又很酷
    2021-01-04 12:33

    Just use WeakReferences for the discardable results, then they will be discarded if necessary for space reasons.

提交回复
热议问题