PSYoungGen /PSOldGen/PSPermGen区别

原文地址:http://bbs.csdn.net/topics/210064791


谁能解译一下PSYoungGen /PSOldGen/PSPermGen区别及出现的问题?


看来没有收集到答案,查看了很多书,终于是知道了.

在这里提供给大家学习学习,同时自己也巩固一下!

SUN JVM GC 使用是分代收集算法,即将内存分为几个区域,将不同生命周期的对象放在不同区域里.
新的对象会先生成在Young area,也就是PSYoungGen
在几次GC以后,如过没有收集到,就会逐渐升级到PSOldGen 及Tenured area(也就是PSPermGen)中。

三者区别:
在GC收集的时候,频繁收集生命周期短的区域(Young area),因为这个区域内的对象生命周期比较短,GC 效率也会比较高。而比较少的收集生命周期比较长的区域(Old area or Tenured area),以及基本不收集的永久区(Perm area)。


示例:

Event: 31.128 GC heap before
{Heap before GC invocations=11 (full 0):
 PSYoungGen      total 28928K, used 25856K [0x00000000ef560000, 0x00000000f18b0000, 0x0000000100000000)
  eden space 22336K, 100% used [0x00000000ef560000,0x00000000f0b30000,0x00000000f0b30000)
  from space 6592K, 53% used [0x00000000f1240000,0x00000000f15b0000,0x00000000f18b0000)
  to   space 6912K, 0% used [0x00000000f0b30000,0x00000000f0b30000,0x00000000f11f0000)
 ParOldGen       total 68288K, used 14219K [0x00000000ce000000, 0x00000000d22b0000, 0x00000000ef560000)
  object space 68288K, 20% used [0x00000000ce000000,0x00000000cede2f78,0x00000000d22b0000)
 PSPermGen       total 21248K, used 9290K [0x00000000c8e00000, 0x00000000ca2c0000, 0x00000000ce000000)
  object space 21248K, 43% used [0x00000000c8e00000,0x00000000c97129e0,0x00000000ca2c0000)
Event: 31.136 GC heap after
Heap after GC invocations=11 (full 0):
 PSYoungGen      total 24256K, used 2400K [0x00000000ef560000, 0x00000000f18d0000, 0x0000000100000000)
  eden space 21824K, 0% used [0x00000000ef560000,0x00000000ef560000,0x00000000f0ab0000)
  from space 2432K, 98% used [0x00000000f0b30000,0x00000000f0d88000,0x00000000f0d90000)
  to   space 7232K, 0% used [0x00000000f11c0000,0x00000000f11c0000,0x00000000f18d0000)
 ParOldGen       total 68288K, used 16467K [0x00000000ce000000, 0x00000000d22b0000, 0x00000000ef560000)
  object space 68288K, 24% used [0x00000000ce000000,0x00000000cf014f78,0x00000000d22b0000)
 PSPermGen       total 21248K, used 9290K [0x00000000c8e00000, 0x00000000ca2c0000, 0x00000000ce000000)
  object space 21248K, 43% used [0x00000000c8e00000,0x00000000c97129e0,0x00000000ca2c0000)
}

你可能感兴趣的:(Java)