Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

JavaÄÚ´æ¹ÜÀí(¶þ¡¢JavaÀ¬»ø»ØÊÕ)

¶þ¡¢JavaÀ¬»ø»ØÊÕ
1. JVMÔËÐл·¾³ÖÐÀ¬»ø¶ÔÏóµÄ¶¨Òå
     Ò»¸ö¶ÔÏó´´½¨ºó±»·ÅÖÃÔÚJVMµÄ¶ÑÄÚ´æÖУ¬µ±ÓÀÔ¶²»ÔÙÒýÓÃÕâ¸ö¶ÔÏóʱ£¬Ëü½«±»JVMÔÚ¶ÑÄÚ´æÖлØÊÕ¡£»ò  µ±¶ÔÏóÔÚJVMÔËÐпռäÖÐÎÞ·¨Í¨¹ý¸ù¼¯ºÏ(root set)µ½´ïʱ£¬Õâ¸ö¶ÔÏó¾Í±»³ÆÎªÀ¬»ø¶ÔÏó¡£
2. ¶ÑÄÚ´æ
* ÔÚJVMÆô¶¯Ê±±»´´½¨£»¶ÑÄÚ´æÖÐËù´æ´¢µÄ¶ÔÏó¿ÉÒÔ±»JVM×Ô¶¯»ØÊÕ£¬²»ÄÜͨ¹ýÆäËûÍⲿÊֶλØÊÕ
* ¶ÑÄÚ´æ¿É·ÖΪÁ½¸öÇøÓò£ºÐ¶ÔÏóÇøºÍÀ϶ÔÏóÇø
    -- жÔÏóÇø¿É·ÖΪÈý¸öÐ¡Çø£ºEdenÇø¡¢fromÇø¡¢ToÇø
    EdenÇøÓÃÀ´±£´æÐ´´½¨µÄ¶ÔÏ󣬵±EdenÇøÖеĶÔÏóÂúÁËÖ®ºó£¬JVM½«»á×ö¿É´ïÐÔ²âÊÔ£¬¼ì²âÓÐÄÄЩ¶ÔÏóÓɸù¼¯ºÏ³ö·¢ÊDz»¿É´ïµÄ£¬²»¿É´ïµÄ¶ÔÏó¾Í»á±» JVM»ØÊÕ£¬²¢½«ËùÓеĻ¶ÔÏó´ÓEdenÇø¿½µ½ToÇø£¬´ËʱһЩ¶ÔÏ󽫷¢Éú״̬½»»»£¬ÓеĶÔÏó¾Í´ÓToÇø±»×ªÒƵ½fromÇø¡£
3. JVMÖжÔÏóµÄÉúÃüÖÜÆÚ
 * ´´½¨½×¶Î(²½Öè)
    -- Ϊ¶ÔÏó·ÖÅä´æ´¢¿Õ¼ä
    -- ¿ªÊ¼¹¹Ôì¶ÔÏó
    -- µÝ¹éµ÷ÓÃÆä³¬ÀàµÄ¹¹Ôì·½·¨
    -- ½øÐжÔÏóʵÀý³õʼ»¯Óë±äÁ¿³õʼ»¯
    -- Ö´Ðй¹Ôì·½·¨Ìå
 * Ó¦Óý׶Î
    -- ÌØÕ÷£ºÏµÍ³ÖÁÉÙά»¤×ŶÔÏóµÄÒ»¸öÇ¿ÒýÓã»ËùÓжԸöÔÏóÒýÓÃÇ¿ÒýÓÃ(³ý·ÇÏÔʾÉùÃ÷ΪÆäËüÒýÓÃ)
    -- Ç¿ÒýÓÃ
      Ö¸JVMÄÚ´æ¹ÜÀíÆ÷´Ó¸ùÒýÓü¯ºÏ³ö·¢£¬±éѰ¶ÑÖÐËùÓе½´ï¶ÔÏóµÄ·¾¶¡£µ±µ½´ïij¶ÔÏóµÄÈÎÒâ·¾¶¶¼²»º¬ÓÐÒýÓöÔÏóʱ£¬¶ÔÕâ¸ö¶ÔÏóµÄÒýÓþͱ»³ÆÎªÇ¿ÒýÓá£
µ±ÄÚ´æ²»×ãʱ£¬JVMÄþÔ¸Å׳öOutOfMemeryError´íÎóʹ³ÌÐòÍ£Ö¹£¬Ò²²»»á¿¿ÊջؾßÓÐÇ¿ÒýÓõĶÔÏóÀ´ÊÍ·ÅÄÚ´æ¿Õ¼ä
    -- ÈíÒýÓÃ
      ËüÄÜʵÏÖcache¹¦ÄÜ£¬·ÀÖ¹×î´óÏ޶ȵÄʹÓÃÄÚ´æÊ±ÒýÆðµÄOutOfMemoryÒì³££¬ÔÚÄÚ´æ²»¹»ÓõÄʱºòjvm»á×Ô¶¯»ØÊÕSoft Reference¡£
ÈíÒýÓÿÉÒÔºÍÒ»¸öÒýÓöÓÁÐ(ReferenceQueue)ÁªºÏʹÓã¬Èç¹ûÈíÒýÓÃËùÒýÓõĶÔÏó±»À¬»ø»ØÊÕ£¬javaÐéÄâ»ú¾Í»á°ÑÕâ¸öÈíÒýÓüÓÈëµ½ÓëÖ®¹ØÁªµÄÒýÓöÓÁÐÖС£
      JavaÖÐÌṩÈíÒýÓõİü£ºjava.lang.ref.SoftReference(ºóÐøÏê½â)
     ÈíÒýÓÃ
      ÊµÏÖcache¹¦ÄÜ,·ÀÖ¹×î´óÏ޶ȵÄʹÓÃÄÚ´æÊ±ÒýÆðµÄOutOfMemoryÒì³£,ÔÚÄÚ´æ²»¹»ÓõÄʱºòjvm»á×Ô¶¯»ØÊÕSoft Reference.ÈíÒýÓÃ


Ïà¹ØÎĵµ£º

JAVA¼¯ºÏÀà


java.util°üÖоͰüº¬ÁËһϵÁÐÖØÒªµÄ¼¯ºÏÀ࣬¶ø¶ÔÓÚ¼¯ºÏÀ࣬Ö÷ÒªÐèÒªÕÆÎյľÍÊÇËüµÄÄÚ²¿½á¹¹£¬ÒÔ¼°±éÀú¼¯ºÏµÄµü´úģʽ¡£
½Ó¿Ú£ºCollection
ËùÓм¯ºÏÀàµÄ¸ùÀàÐÍ£¬Ö÷ÒªµÄÒ»¸ö½Ó¿Ú·½·¨£ºboolean add(Ojbect c)Ëä·µ»ØµÄÊÇboolean£¬µ«²»ÊDZíʾÌí¼Ó³É¹¦Óë·ñ£¬ÒòΪCollection¹æ¶¨£ºÒ»¸ö¼¯ºÏ¾Ü¾øÌí¼ÓÕâ¸öÔªËØ£¬ÎÞÂÛʲôԭÒò£¬¶¼± ......

javaÖÐɾ³ýÎļþÀÏʧ°ÜµÄ½â¾ö°ì·¨

¸Õ²ÅÔÚ×ö¸ö²âÊÔʱ  ɾ³ýÎļþÀÏÊÇʧ°Ü...Ò»Ö±ÕÒ²»µ½Ô­Òò.. file.delete();
×ÜÊÇ·µ»Øfalse.
ÔÚÍøÉÏÕÒÁ˰ëÌì  ¶¼ÕÒ²»µ½´íÔÚÄĶù..
if(file.exists() && file.canWrite())
file.delete();
ÕâÑù¶¼²»ÐС­
ºóÀ´Í»È»Í»È»Ïëµ½´íÔÚÄĶùÁË..
¾ÍÊÇÔÚдÍêÎļþºóûÓÐclose
out.write(b);
out.flush();
out.close(); ......

Java MailÎÞ·¨½âÎö´ø·ÖºÅµÄÊÕ¼þÈËÁбíµÄÎÊÌâ

Java MailÎÞ·¨½âÎö´ø·ÖºÅµÄÊÕ¼þÈËÁбíµÄÎÊÌâ
      ½ñÌìͬÊÂÅöµ½Ò»¸öÎÊÌ⣬ʹÓÃJAVA MAILÊÕÈ¡Óʼþʱ£¬Èç¹ûÊÕ¼þÈËÊǸöÁÐ±í£¬ÇÒÊÕ¼þÈËÁбíÊÇÒԷֺŽøÐзָîµÄ£¬ÔòJAVA MAIL¾Í»á³öÏÖÒì³££¬²»ÄÜÕý³£½âÎö£¬³é¿Õ¿´ÁËÒ»ÑÛ£¬×Ô¼ºÐ´Á˸ö¼òµ¥demo£¬ºÜ¼òµ¥£¬ÀýÈ磺
  @Test
public void te ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ