Cov txheej txheem:

Kuv yuav saib cov ntaub ntawv heap dump li cas?
Kuv yuav saib cov ntaub ntawv heap dump li cas?

Video: Kuv yuav saib cov ntaub ntawv heap dump li cas?

Video: Kuv yuav saib cov ntaub ntawv heap dump li cas?
Video: Ua siab hnov qab kuv mus by zuag lauj & pov vwj nkauj tawm tshiab 2020 2024, Kaum ib hlis
Anonim

Yog koj muaj ib tug heap dump ntaub ntawv rua ntawm koj qhov system hauv zos, koj tuaj yeem qhib qhov ntaub ntawv hauv Java VisualVM los ntawm kev xaiv Cov ntaub ntawv > Load los ntawm lub ntsiab zaub mov. Java VisualVM tuaj yeem qhib pob tseg pob cawm hauv. hprof ntaub ntawv hom ntawv. Thaum twg koj qhib a cawm pob tseg , cov pob tseg opens raws li ib tug tab nyob rau hauv lub ntsiab qhov rais.

Kuj tseem paub yog, kuv yuav ua li cas thiaj ua tau 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.

Ib yam li ntawd, kuv yuav nyeem Java cov ntaub ntawv pov tseg li cas? Koj tuaj yeem siv jvisualvm.exe uas los nrog JDK 1.5 thiab siab dua. Nws tam sim no nyob rau hauv bin folder ntawm JDK. Qhov no yog ib qho cuab yeej zoo heev uas tuaj yeem siv los ua profile txawm tias khiav Java daim ntawv thov. Koj tuaj yeem siv JProfiler rau nyeem pob pov tseg cov ntaub ntawv.

Kuj paub, dab tsi yog lub pob pov tseg?

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.

Dab tsi yog kev siv heap dump?

A pob tseg yog ib qho snapshot ntawm tag nrho cov khoom uas nyob rau hauv lub cim xeeb nyob rau hauv lub JVM ntawm ib lub sij hawm. Lawv muaj txiaj ntsig zoo los daws cov teeb meem nco-tawg thiab txhim kho kev nco kev siv hauv Java apps. Heap dumps feem ntau yog khaws cia rau hauv binary hom ntawv hprof cov ntaub ntawv.

Pom zoo: