How can I figure out what is holding on to unfreed objects?

前端 未结 11 1001
忘了有多久
忘了有多久 2020-12-13 16:11

One of our programs is sometimes getting an OutOfMemory error on one user\'s machine, but of course not when I\'m testing it. I just ran it with JProfiler (on

11条回答
  •  一生所求
    2020-12-13 16:38

    Some suggestions:

    • Unlimited maps used as caches, especially when static
    • ThreadLocals in server apps, because the threads usually do not die, so the ThreadLocal is not freed
    • Interning strings (Strings.intern()), which results in a pile of Strings in the PermSpace

提交回复
热议问题