简体   繁体   English

无法为对象堆保留足够的空间

[英]Could not reserve enough space for object heap

I'm writing a wrapper to Lucene. 我正在为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 . 我认为潜在的问题与SO问题的良好答案中描述的相同无法为对象堆保留足够的空间

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. 也就是说,JVM正在尝试向操作系统询问堆的内存,并且操作系统正在拒绝,因为它已经将所有虚拟内存分配给其他进程。

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. 当新的JVM开始运行索引器时,操作系统更有可能说“不”。

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 ...) (顺便说一句,我不认为切换到64位操作系统必然帮助,并运行64位JVM肯定不会帮...)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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