简体   繁体   中英

Could not reserve enough space for object heap

I'm writing a wrapper to Lucene. When a search request is made frequently, it's possible "Could not reserve enough space for object heap" will be thrown. How can I get the size of the object heap? And how can I solve that?

I believe that the underlying problem is the same as is described in the good answers to the SO question Could not reserve enough space for object heap .

That is, the JVM is attempting to ask the OS for memory for the heap, and the OS is refusing because it has already allocated all virtual memory to other processes.

I expect that this happens when you launch the indexer frequently because:

  • it is increasing the system average load (number of processes running / waiting to run), and therefore
  • it is increasing the system's average committed virtual memory resources, and therefore
  • it is making it more likely that the OS has to say "No" when a new JVM starts to run the indexer.

Of course, this is largely conjecture ...


What can you do about it?

  1. Increase the size of the disc file or partition used for paging.
  2. Add more physical memory to the machine.
  3. Run the indexer less often and / or when the system is not busy.
  4. Trim the size of the indexer's heap.
  5. Move some of the other load off onto another machine.

Some of these need to be done with care, because they could impact on overall system performance in various ways.

(Incidentally, I don't think that switching to a 64 bit OS will necessarily help, and running a 64 bit JVM certainly won't help ...)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM