我的Glassfish安装程序是否泄漏内存? [英] Is my Glassfish setup leaking memory?

查看:97
本文介绍了我的Glassfish安装程序是否泄漏内存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一台Glassfish v3服务器运行几个Web应用程序(servlet,JSP,JDBC)。我一直注意到,如果我让Glassfish运行很长时间,它会占用所有可用内存(这是在750 MB内存的服务器上运行)。



我发现必须有内存泄漏,所以我在运行服务器的同时使用JProfiler进行监控,并注意到当我的流量达到峰值时,我的内存使用量增加(如预期的那样),但之后迅速下降。



我想知道这个问题是不是内存泄漏,还有更多的是Glassfish在峰值出现时扩展堆大小(这似乎确实发生了)但在实际内存使用率下降时从不减小堆大小。





然而,根据这张图,它看起来好像是内存使用量(蓝色)趋势随着服务器运行时间延长。



我的问题有两方面:


  1. 有什么办法让他有ap的大小在实际内存使用量下降后下降?


  2. 有可能我有内存泄漏,或者这是正常的吗?我能做些什么来进一步调查这种内存使用情况?

  3. 不会看起来像内存泄漏,因为内存会不断增长,它会真的开始OOM错误,这很可能是HotSpot编译器将解释代码转换为本地代码,这肯定会声称内存,并永远不会给它回忆,因为这种记忆会传递到永恒的一代。



    您应该使用像JConsole或VisualVM这样的工具来确保这是一个泄漏,而不是其他事情。 / p>

    I've got a Glassfish v3 server running a few web applications (servlets, JSP, JDBC). I'd been noticing that if I let Glassfish run for a long time, it will consume all of the memory available (this is running on a server with 750 MB of memory).

    I figured that there must be a memory leak, so I ran the server while monitoring it with JProfiler and noticed that when I get a peak in traffic, my memory usage shoots up (as expected), but then quickly drops back down.

    I'm wondering if the issue is less of a memory leak, and more that Glassfish expands its heap size when the spikes occur (this does seem to be happening) but never decreases the heap size when the actual memory usage declines.

    However, based on this graph, it does seem like the memory usage (blue) is trending upwards as the server runs longer.

    My question is two-fold:

    1. Is there any way to have the heap size decreased when the actual memory usage drops after a spike?

    2. Is it probable that I do have a memory leak, or is this normal? What can I do to investigate this memory usage further?

    解决方案

    It does not look like a memory leak, as memory would keep on growing forever and it would really start blowing up with OOM errors, this is most likely the HotSpot compiler turning interpreted code into native code and this is surely going to claim memory and never give it back, as this memory goes to the eternal generation.

    You should probably use a tool like JConsole or VisualVM to make sure that this is a leak and not something else.

    这篇关于我的Glassfish安装程序是否泄漏内存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆