zoukankan      html  css  js  c++  java
  • 013

     
    Question:
     
    I have some third library code that I run and after some time I run into OutOfMemoryError. So I fired up the Eclipse MAT and analyzed the memory. Now it seems the memory can't be disposed because there is an object that is a shown as GC root: Native Stack
     
     
    Answer:
     
    Objects being shown as GC root: Native Stack turned out to be a problem of the Eclipse Debugger. When the application was started without the debugger (i.e. with 'run' instead of 'debug') the problem disappeared. This was also the reason that I couldn't find the code where the objects where used in JNI inside my project (cause they weren't).
    The same problem appears when using IntelliJ Debugger
     
     
    简单说:
       通过Eclipse或者IntelliJ  采用debug模式启动程序时,发生内存溢出错误后,由于存在 GC root: Native Stack,导致发生错误的方法中创建的对象无法释放 (正常情况下,发生错误后,方法调用结束,对象会被正常释放的)。
    解决方法:采用run运行(非debug模式),就不会存在该问题了013 - 关于GC root: Native Stack  |  MAT分析
  • 相关阅读:
    LinkLabel控件使用
    读取mysql代码片段
    设置点风格
    C# List 用法
    图片焦点图切换效果
    dreamweaver 泛泛之谈
    js 之for..in、表单及事件触发
    实现省份查询 功能
    input类主要是
    js (1)
  • 原文地址:https://www.cnblogs.com/756623607-zhang/p/8993885.html
Copyright © 2011-2022 走看看