[英]can you help me with this error on my project?
when click button run... in output.... 当单击按钮运行时...在输出中...
java.lang.OutOfMemoryError
OpenCV Error: Insufficient memory (Failed to allocate 6220800 bytes) in unknown function, file ..\..\..\src\opencv\modules\core\src\alloc.cpp, line 52
Exception in thread "Thread-4" java.lang.RuntimeException: ..\..\..\src\opencv\modules\core\src\alloc.cpp:52: error: (-4) Failed to allocate 6220800 bytes
at com.googlecode.javacv.cpp.opencv_core.cvCloneImage(Native Method)
at com.googlecode.javacv.cpp.opencv_core$IplImage.clone(opencv_core.java:521)
at vidtracking.MainView.backgroundSubtraction(MainView.java:666)
at vidtracking.MainView.access$1000(MainView.java:32)
at vidtracking.MainView$8.run(MainView.java:461)
java.lang.OutOfMemoryError OpenCV Error: Insufficient memory
This exception is thrown Because. 引发此异常是因为。 OutOfMemoryError
OutOfMemoryError
when the Java Virtual Machine cannot allocate an object because it is out of memory, and no more memory could be made available by the garbage collector.
当Java虚拟机因为内存不足而无法分配对象,并且垃圾回收器无法再提供更多内存时。 OutOfMemoryError objects may be constructed by the virtual machine as if suppression were disabled and/or the stack trace was not writable.
虚拟机可以构造OutOfMemoryError对象,就像禁用抑制和/或堆栈跟踪不可写一样。
Common solutions in this case are: 在这种情况下,常见的解决方案是:
Xmx
switch eg -Xmx512m
(you can help yourself finding correct value by connecting to your JVM with JXM and Jconsole). Xmx
开关(例如-Xmx512m
增加堆大小(您可以通过使用JXM和Jconsole连接到JVM来帮助自己找到正确的值)。 -XX:-UseGCOverheadLimit
The third approach will only result in another kind of error messages – heap related java.lang.OutOfMemoryError. -XX:-UseGCOverheadLimit
禁用错误检查第三种方法将仅导致另一种错误消息–与堆相关的java.lang.OutOfMemoryError。 -XX:+HeapDumpOnOutOfMemoryError
to JAVA_OPTS and analyse the dump with IBM Memory Analyzer (part of IBM Support Assistant Workbench) looking for memory leaks (see references). -XX:+HeapDumpOnOutOfMemoryError
添加到JAVA_OPTS并使用IBM Memory Analyzer(IBM Support Assistant Workbench的一部分)分析转储以查找内存泄漏(请参阅参考资料)。 Only for netbeans . 仅适用于netbeans 。
The correct way is to right-click on the project and select " Properties " and then " Run "; 正确的方法是右键单击项目,然后选择“ 属性 ”,然后选择“ 运行 ”。 there you can set the VM options appropriately (-Xmx256m, for instance).
在那里您可以适当地设置VM选项(例如-Xmx256m)。 It should look something like this:
它看起来应该像这样:
java.lang.OutOfMemoryError OpenCV Error: Insufficient memory
It seems you are loading large file into memory. 看来您正在将大文件加载到内存中。 Try to increase memory using -Xms and -Xmx settings .
尝试使用-Xms和-Xmx设置来增加内存 。
If you have more memory than file size, then possible cause could be some memory leaks. 如果您的内存大于文件大小,则可能的原因可能是某些内存泄漏。
You need to allocate atleast 6220800 bytes (ie ~6mb). 您需要分配至少6220800字节(即〜6mb)。
Run your java app with these jvm settings (to allocate more heap size): 使用以下jvm设置运行Java应用程序(以分配更多的堆大小):
java myapp.jar -Xms10m -Xmx10m
For eclipse: 对于日食:
Windows Preferences -> java -> Installed JREs:
Select JRE/JDK you are using
Click Edit
Set VM arguments: -Xms10m -Xmx10m
Start your app again.
Its symptom of JVM crash or no memory for allocation of resource in JVM. 它的症状是JVM崩溃或JVM中没有用于分配资源的内存。 try to tune your program or increase JVM memory
尝试调整程序或增加JVM内存
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.