Cov txheej txheem:

Yuav ua li cas kuv pom ib lub pob pov tseg?
Yuav ua li cas kuv pom ib lub pob pov tseg?

Video: Yuav ua li cas kuv pom ib lub pob pov tseg?

Video: Yuav ua li cas kuv pom ib lub pob pov tseg?
Video: Yuav Tsis Ruam Ntxiv by (Pov Lis) 2024, Hlis ntuj nqeg
Anonim

Yog koj muaj ib tug pob tseg cov ntaub ntawv khaws tseg rau hauv koj lub zos, koj tuaj yeem qhib cov ntaub ntawv hauv Java VisualVM los ntawm xaiv Cov Ntaub Ntawv> Load los ntawm cov ntawv qhia zaub mov tseem ceeb. Java VisualVM tuaj yeem qhib pob tseg pob cawm hauv. hprof file format. Thaum koj qhib tau txais kev cawmdim pob tseg , cov pob tseg opens raws li ib tug tab nyob rau hauv lub ntsiab qhov rais.

Ib yam li ntawd, kuv yuav ua li cas thiaj ua tau ib lub pob pov tseg?

Muaj ntau ntau txoj hauv kev los tsim java heap dump:

  1. Siv jmap -dump kev xaiv kom tau txais lub pob pov tseg ntawm lub sijhawm khiav;
  2. Siv jconsole kev xaiv kom tau txais cov pob pov tseg ntawm HotSpotDiagnosticMXBean ntawm lub sijhawm khiav;
  3. Heap pob tseg yuav raug tsim tawm thaum OutOfMemoryError raug pov los ntawm kev qhia -XX: +HeapDumpOnOutOfMemoryError VM xaiv;
  4. Siv hprof.

Kuj Paub, heap dump yog dab tsi? A pob tseg yog ib qho snapshot ntawm lub cim xeeb ntawm Java ™ txheej txheem. Lub snapshot muaj cov ntaub ntawv hais txog Java cov khoom thiab cov chav kawm hauv pob thaum lub sij hawm lub snapshot yog triggered. Class loader, npe, super class, thiab static teb. Cov hauv paus hniav khib nyiab. Cov khoom tau txhais kom ncav cuag tau los ntawm JVM.

Ntawm no, koj yuav ua li cas txheeb xyuas lub cim xeeb xau rau heap dump?

Mus taug qab a nco xau , koj yuav xav tau ib " pob tseg " nrog rau cov ntsiab lus ntawm cov khoom nyob hauv cov txheej txheem xau. Los sau a pov tseg , ua ntej khiav jps mus nrhiav tus txheej txheem PID, ces khiav jmap - pov tseg :live, format=b, file=(dumpfile) (pid).

Vim li cas heap dump generated?

The JVM tsim tus Pob pov tseg cov ntaub ntawv nyob rau hauv cov ntaub ntawv txoj kev. Tej zaum peb yuav xav tau Pob pov tseg nyob rau hauv lub hauv paus ntawm kev thov. Yuav kom daws tau qhov kev siv nco, peb xav tau Pob pov tseg . Yog tias koj tsis tau teev HeapDumpPath, ces JVM tsim cov ntaub ntawv uas tus txheej txheem JAVA tab tom khiav.

Pom zoo: