PermGen space Java heap space ÄÚ´æÒç³ö
1¡¢
PermGen spaceµÄÈ«³ÆÊÇPermanent Generation space,ÊÇÖ¸ÄÚ´æµÄÓÀ¾Ã±£´æÇøÓòOutOfMemoryError: PermGen space´Ó±íÃæÉÏ¿´¾ÍÊÇÄÚ´æÒæ³ö£¬½â¾ö·½·¨Ò²Ò»¶¨ÊǼӴóÄڴ档˵˵Ϊʲô»áÄÚ´æÒæ³ö£ºÕâÒ»²¿·ÖÓÃÓÚ´æ·ÅClassºÍMetaµÄÐÅÏ¢,ClassÔÚ±» LoadµÄʱºò±»·ÅÈëPermGen spaceÇøÓò£¬ËüºÍºÍ´æ·ÅInstanceµÄHeapÇøÓò²»Í¬,GC(Garbage Collection)²»»áÔÚÖ÷³ÌÐòÔËÐÐÆÚ¶ÔPermGen space½øÐÐÇåÀí£¬ËùÒÔÈç¹ûÄãµÄAPP»áLOADºÜ¶àCLASSµÄ»°,¾ÍºÜ¿ÉÄܳöÏÖPermGen space´íÎó¡£ÕâÖÖ´íÎó³£¼ûÔÚweb·þÎñÆ÷¶ÔJSP½øÐÐpre compileµÄʱºò¡£
¸ÄÕý·½·¨£º-Xms256m -Xmx256m -XX:MaxNewSize=256m -XX:MaxPermSize=256m
2¡¢
ÔÚtomcatÖÐredeployʱ³öÏÖoutofmemoryµÄ´íÎó.
¿ÉÒÔÓÐÒÔϼ¸¸ö·½ÃæµÄÔÒò:
£±,ʹÓÃÁËproxool,ÒòΪproxoolÄÚ²¿°üº¬ÁËÒ»¸öÀÏ°æ±¾µÄcglib.
2, log4j,×îºÃ²»ÓÃ,Ö»ÓÃcommon-logging
3, ÀÏ°æ±¾µÄcglib,¿ìµã¸üе½×îа档
£´£¬¸üе½×îеÄhibernate3.2
3¡¢
ÕâÀïÒÔtomcat»·¾³ÎªÀý£¬ÆäËüWEB·þÎñÆ÷Èçjboss,weblogicµÈÊÇͬһ¸öµÀÀí¡£
Ò»¡¢java.lang.OutOfMemoryError: PermGen space
PermGen spaceµÄÈ«³ÆÊÇPermanent Generation space,ÊÇÖ¸ÄÚ´æµÄÓÀ¾Ã±£´æÇøÓò,
Õâ¿éÄÚ´æÖ÷ÒªÊDZ»JVM´æ·ÅClassºÍMetaÐÅÏ¢µÄ,ClassÔÚ±»Loaderʱ¾Í»á±»·Åµ½PermGen spaceÖÐ,
ËüºÍ´æ·ÅÀàʵÀý(Instance)µÄHeapÇøÓò²»Í¬,GC(Garbage Collection)²»»áÔÚÖ÷³ÌÐòÔËÐÐÆÚ¶Ô
PermGen space½øÐÐÇåÀí£¬ËùÒÔÈç¹ûÄãµÄÓ¦ÓÃÖÐÓкܶàCLASSµÄ»°,¾ÍºÜ¿ÉÄܳöÏÖPermGen space´íÎó,
ÕâÖÖ´íÎó³£¼ûÔÚweb·þÎñÆ÷¶ÔJSP½øÐÐpre compileµÄʱºò¡£Èç¹ûÄãµÄWEB APP϶¼ÓÃÁË´óÁ¿µÄµÚÈý·½jar, Æä´óС
³¬¹ýÁËjvmĬÈϵĴóС(4M)ÄÇô¾Í»á²úÉú´Ë´íÎóÐÅÏ¢ÁË¡£
½â¾ö·½·¨£º ÊÖ¶¯ÉèÖÃMaxPermSize´óС
ÐÞ¸ÄTOMCAT_HOME/bin/catalina.sh
ÔÚ“echo "Using CATALINA_BASE: $CATALINA_BASE"”ÉÏÃæ¼ÓÈëÒÔÏÂÐУº
JAVA_OPTS="-server -XX:PermSize=64M -XX:MaxPermSize=128m
½¨Ò飺½«ÏàͬµÄµÚÈý·½jarÎļþÒÆÖõ½tomcat/shared/libĿ¼Ï£¬ÕâÑù¿ÉÒÔ´ïµ½¼õÉÙjar ÎĵµÖظ´Õ¼ÓÃÄÚ´æµÄÄ¿µÄ¡£
¶þ¡¢java.lang.OutOfMemoryError: Java heap space
Heap size ÉèÖÃ
JVM¶ÑµÄÉèÖÃÊÇÖ¸java³ÌÐòÔËÐйý³ÌÖÐJVM¿ÉÒÔµ÷ÅäʹÓõÄÄÚ´æ¿Õ¼äµÄÉèÖÃ.JVMÔÚÆô¶¯µÄʱºò»á×Ô¶¯ÉèÖÃHeap sizeµÄÖµ£¬
Æä³õʼ¿Õ¼ä(¼´-Xms)ÊÇÎïÀíÄÚ´æµÄ1/64£¬×î´ó¿Õ¼ä(-Xmx)ÊÇÎïÀíÄÚ´æµÄ1/4¡£¿ÉÒÔÀûÓÃJVMÌṩµÄ-Xmn -Xms -XmxµÈÑ¡Ïî¿É
½øÐÐÉèÖá£Hea
Ïà¹ØÎĵµ£º
Java×¢Ê͹淶
¶¨ÒåÕâ¸ö¹æ·¶µÄÄ¿µÄÊÇÈÃÏîÄ¿ÖÐËùÓеÄÎĵµ¶¼¿´ÆðÀ´ÏñÒ»¸öÈËдµÄ£¬Ôö¼Ó¿É¶ÁÐÔ£¬¼õÉÙÏîÄ¿×éÖÐÒòΪ»»È˶ø´øÀ´µÄËðʧ¡££¨ÕâЩ¹æ·¶²¢²»ÊÇÒ»¶¨Òª¾ø¶Ô×ñÊØ£¬µ«ÊÇÒ»¶¨ÒªÈóÌÐòÓÐÁ¼ºÃµÄ¿É¶ÁÐÔ£©¡£
Java µÄÓï·¨Óë C++ ¼°ÎªÏàËÆ£¬ÄÇô£¬ÄãÖªµÀ Java µÄ×¢ÊÍÓм¸ÖÖÂð£¿ÊÇÁ½ÖÖ£¿ ¡¡¡¡
// ×¢ÊÍÒ»ÐС¡¡¡
/* ...... */ ×¢Ê ......
1.¶ÁÈ¡XMLÎļþµÄÀࣺ
public class XMLUtils {
private final String DB_XML_FILE = "/XMLSetting.xml";
public Properties getPropertiesfromXML() {
URL url = XMLUtils.class.getResource(dBXMLFILE);
URI uri;
try {
uri = url.toURI();
InputSource xmlfile = new InputSource(uri.g ......
import java.net.*;
import java.io.*;
public class PortScanner {
public static void main(String args[]){
String host="localhost";
new PortScanner().scan(host);
}
public void scan(String host){
  ......
¹Ø¼ü×Ö: java excel jxl.jar
jxl.jar °ü
ÏÂÔصØÖ·:
ÕæʵÏÂÔصØÖ·:
ÍøÕ¾É϶ÔËüµÄÌØÕ÷ÓÐÈçÏÂÃèÊö£º
¡ñ Ö§³ÖExcel 95-2000µÄËùÓа汾
¡ñ Éú³ÉExcel 2000±ê×¼¸ñʽ
¡ñ Ö§³Ö×ÖÌå¡¢Êý×Ö¡¢ÈÕÆÚ²Ù×÷
¡ñ Äܹ»ÐÞÊε¥Ôª¸ñÊôÐÔ
¡ñ Ö§³ÖͼÏñºÍͼ±í
Ó¦¸Ã˵ÒÔÉϹ¦ÄÜÒѾÄܹ»´óÖÂÂú×ãÎÒÃǵÄÐèÒª¡£×î¹Ø¼üµÄÊÇÕâÌ×APIÊÇ´¿J ......