ngomong2 itu aplikasi apa sampe haus thread kayak gitu? 2010/5/1 Wiyanto Ngasinur <wngasi...@gmail.com>
> > > Gue belon implement ini sih, cuma skrg gue lagi buat POC aja jaga2 ... > soalnya uda live web nya, kaga bisa main ganti aja. > Tapi saran dari boz Samuel, uda menunjukan tanda2 yg bagus. Gue ada buat > program kecil utk simulasi issue ini. > > @Test > public void testThread() { > for(int i=0;i<8000;i++) > { > ThreadUhui g = new ThreadUhui(); > g.start(); > } > } > class ThreadGila extends Thread > { > Map map = new HashMap(); > public void run() > { > System.out.println("Thread "+Thread.currentThread().getId()); > try > { > for(int i=0;i<1000;i++) > { > map.put(i, i); > } > Thread.sleep(10000000); > }catch(Exception e) { > fail("Fail "+Util.getStackTrace(e)); > } > } > } > > ini kalo gue jalanin cuma pake Xmx1G, kaga berhasil, kena > "java.lang.OutOfMemoryError: unable to create new native thread". > Tapi kalo dijalanin pake Xss64k Xmx1G, berhasil !!! tapi nurut yg gue baca > disana kalo stack size nya kekecilan bisa kena StackOverflow jg, jadi > bingung... maju kena mundur kena. > > Itu nyoba nya di Sun JVM. Nih gue mo nyobain di IBM JVM, kalo berhasil baru > gue apply. > > thanks, > Wiyanto > > 2010/5/1 Samuel Franklyn <sfrank...@gmail.com> > > >> >> Betul dikecilin.Bahkan bukan cuma stack size tapi juga heap sizenya. >> Aku juga pernah mengalami masalah yang sama. Aku punya aplikasi >> yang memanfatkan object COM+ di Windows dan membutuhkan banyak >> sekali thread native. Makin besar heap size dia makin cepat hang. >> Tapi begitu stack size di perkecil dan heap size di perkecil malah >> stabil sampai saat ini. Tapi berhubung pakai COM+ aplikasi ini >> terpaksa di restart app servernya 1 hari sekali. Lancar jaya sampai saat >> ini. >> >> >> On Fri, Apr 30, 2010 at 6:01 PM, Wiyanto Ngasinur <wngasi...@gmail.com>wrote: >> >>> >>> >>> Hi Samuel, >>> >>> kok dikecilin ya stack size nya, bukan digedein? >>> >>> thanks, >>> W >>> >>> On Fri, Apr 30, 2010 at 4:09 PM, Samuel Franklyn <sfrank...@gmail.com>wrote: >>> >>>> >>>> >>>> On 4/30/2010 2:58 PM, Wiyanto Ngasinur wrote: >>>> > >>>> > >>>> > Hi master2 GC/JVM, >>>> > >>>> > Gue ada aplikasi Websphere portal server 6.1 jalan di windows 2k3 >>>> memory >>>> > 4 gig. Settingan Xmx uda dimain2kan ampe mendekati 2GB. Makin tinggi >>>> > makin cepet crash nih barang -_-. >>>> > Berikut stacktrace nya : >>>> > >>>> > >>>> > Pertanyaan utamanya : apa hubungan thread ama memory ???? >>>> > >>>> > Nih server hampir mati tiap hari, bahkan malam2 jg bisa out of memory >>>> > tiba2 ... Ada yg bisa bantu ? byk yg bilank upgrade ke 64 bit, tapi >>>> gue >>>> > ga yakin jg. Ada yg bisa share settingan optimal JVM utk operating >>>> > system windows 32 bit dgn mem 4gb, mungkin bisa dishare jg. >>>> > >>>> > thanks, >>>> > Wiyanto >>>> > >>>> >>>> http://java.sun.com/docs/hotspot/HotSpotFAQ.html#threads_oom >>>> >>>> My application has a lot of threads and is running out of memory, why? >>>> >>>> You may be running into a problem with the default stack size for >>>> threads. In Java SE 6, the default on Sparc is 512k in the 32-bit VM, >>>> and 1024k in the 64-bit VM. On x86 Solaris/Linux it is 320k in the >>>> 32-bit VM and 1024k in the 64-bit VM. >>>> >>>> On Windows, the default thread stack size is read from the binary >>>> (java.exe). As of Java SE 6, this value is 320k in the 32-bit VM and >>>> 1024k in the 64-bit VM. >>>> >>>> You can reduce your stack size by running with the -Xss option. For >>>> example: >>>> >>>> java -server -Xss64k >>>> >>>> Note that on some versions of Windows, the OS may round up thread stack >>>> sizes using very coarse granularity. If the requested size is less than >>>> the default size by 1K or more, the stack size is rounded up to the >>>> default; otherwise, the stack size is rounded up to a multiple of 1 MB. >>>> >>>> 64k is the least amount of stack space allowed per thread. >>>> >>>> >>> >> > >