How to: Abort DOM/XML loading when memory is low# Java - 爪哇娇娃
r*s
1 楼
It is using DOM because of POI.
We are not changing the parsers -- too much work.
Assume we have no control of the file size, because the java
vm may be already low in memory, so a small one may blow it.
If it is getting "out of memory error", the whole app is gone.
So the question is whether we could do anything to prevent it
when the memory is low.
We would rather abort the xml loading than halt the whole app.
Any ideas?
We are not changing the parsers -- too much work.
Assume we have no control of the file size, because the java
vm may be already low in memory, so a small one may blow it.
If it is getting "out of memory error", the whole app is gone.
So the question is whether we could do anything to prevent it
when the memory is low.
We would rather abort the xml loading than halt the whole app.
Any ideas?