简体   繁体   English

您可以为我的项目提供帮助吗?

[英]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: 在这种情况下,常见的解决方案是:

  1. Optimize your code to use less memory and/or reuse objects instead of creating new ones thus reducing the number of times the garbage collector runs. 优化代码以使用更少的内存和/或重用对象,而不是创建新的对象,从而减少垃圾收集器运行的次数。 If you create a lot temporary objects (eg in a loop) you should try to reuse them. 如果创建很多临时对象(例如,循环中),则应尝试重用它们。
  2. Increase heap size using 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来帮助自己找到正确的值)。
  3. Disable the error check using -XX:-UseGCOverheadLimit The third approach will only result in another kind of error messages – heap related java.lang.OutOfMemoryError. 使用-XX:-UseGCOverheadLimit禁用错误检查第三种方法将仅导致另一种错误消息–与堆相关的java.lang.OutOfMemoryError。
  4. Add -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.

相关问题 你可以帮我做我的android加法程序吗? - can you help me with my android addition program? 你能帮我写一些关于方法的代码吗? - Can you help me with my codes about methoding? 我的回收视图不起作用。 你能帮助我吗? - My recycleview isn't working. Can you help me? 你能帮我实现克拉克和赖特算法吗? - Can you help me with my Clarke and Wright algorithm implementation? 你能帮我找出这个 Java 代码中的错误吗 - Can you help me to find out the error in this Java Code 我尝试在我的小型 android 项目中使用意向电子邮件,但它不起作用。 谁能帮我找出错误? - I tried to use intent email in my small android project but its not working. Can anyone help me to find the error? 当我尝试在我的 maven 项目中使用 @ResController 时,它显示错误“RestController 无法解析为类型”。帮我解决这个问题 - When i am trying to use @ResController in my maven project it showing error “ RestController can not be resolved to a type”.Help me to resolve this 你能帮我用我的循环计算器吗? - Could you help me with my loop calculator? 我试图用 android studio 发布一个应用程序,但它给了我这个错误你能帮我吗? - I was trying to release an app with android studio but it gave me this error can you help me? 您能帮我理解这个Java代码吗? - Can you help me understand this Java code?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM