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

前端 未结 11 1002
忘了有多久
忘了有多久 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:39

    One obvious candidate is objects with finalisers. They can linger while their finalize method is called. They need to be collected, then finalised (usually with just a single finaliser thread) and then collected again.

    Also be aware that you can get an OOME because the gc failed to collect enough memory, despite there actually being enough for the object request to be created. Otherwise performance would grind into the ground.

提交回复
热议问题