JVM: Is it unsafe to continue working after unsuccessful memory allocation?

I have a process that uses a library to take a step in time and memory, which sometimes takes up too much memory and gives out a failure when distributed on a large request. In this case, it is reasonable to accept the refusal and continue processing, so my decision is to reset my link to this tool and create a new one to continue processing at the next input.

Other people in my group dispute this strategy, stating that as soon as the memory becomes so rigid in the JVM that the distribution fails, the JVM is in a suspicious state: no real evidence, just FUD. On the other hand, I can only argue inductively that I have not yet seen the harmful effects (I have not yet seen black swans).

Q: Is it completely unsafe and verboten to continue working with a JVM that has reset a memory failure?

+3
source share
2 answers

No, this is not entirely unsafe. Although, obviously, it is much better to avoid this if you can, because who knows what uncertain state your data structures will be after you start not allocating memory.

There are many applications (especially webapps) that will survive very well in the event of failures in memory allocation. However, whether it is safe or not depends heavily on the application. Code that constantly updates shared resources will get worse than reusing the example webapps, which have a large degree of separation between different tasks, usually with a small amount of shared resources.

, , . JVM .;)

+3

, , . , , .

+1

All Articles