开发者

Garbage Collection: Eden space getting filled up quickly. Is this due to memory leak? [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 10 years ago.

The eden space is getting filled up quickly in our prod servers forcing minor collection regularly.Th开发者_开发问答e following image shows the GC Analysis of the logfile.

http://imagebin.org/166489

The VM options are listed below.

    <jvm-options>-XX:SurvivorRatio=6</jvm-options>
    <jvm-options>-XX:NewSize=1344m</jvm-options>
    <jvm-options>-XX:MaxNewSize=1344m</jvm-options>
    <jvm-options>-Xms3072m</jvm-options>
    <jvm-options>-Xmx3072m</jvm-options>
    <jvm-options>-XX:MaxPermSize=400m</jvm-options>
    <jvm-options>-XX:NewRatio=2</jvm-options>

Is this happening due to memory leak?

Any help would be greatly appreciated.


An busy application can create about 1/2 GB of garbage per second. This gives you about 2.5 seconds of garbage before your eden space fills. If you creating less than this, your application is not so busy or has efficient code.

If you want to reduce how much garbage you produce, I suggest you profile your application with something like VisualVM or YourKit. An alternative is to increase the eden space. e.g. I would start with 8G or 16GB or 1/3 of your memory. And reduce it as your application is tuned.


Not a memory leak, but you create a lot of temporary objects. I had a problem where we were doing a lot of computations with 3d points witha naive implementation that created a new object for each temporary result (which might work OK in C++) but it was generating gigabytes per second in garbage. After rewriting it so it would reuse objects as much as possible it went down to 20 megs per second.

What can you do? if is your code, try to preallocate arrays, lists and strin buffrs with the expected target size; avoid string concatenation; reuse ovjects. If 6ou have lot of framework code and libraries, you can only try to tune the eden space; check if making it smaller helps your case (yoy will get more GC events that are quicker to finish, you need to measure if it'helping or not).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜