Android Studio를 사용하여 메모리를 분석하는 방법
최근 Eclipse에서 Android Studio로 전환했습니다. Android Studio에서 앱 힙 및 메모리 할당을 확인하는 방법은 무엇입니까? Eclipse에서 MAT가 스튜디오에 힙 덤프, hprof 파일을 확인하는 것이 있습니까?
단계별로 쉽게 설명하겠습니다.
먼저 MAT를 설치 ( 다운로드 )하거나 다음을 사용합니다.
양조 통 설치 메모리 분석기
Android Studio에서 Android Device Monitor 또는 DDMS를 엽니 다.
"com.example.etc .."프로세스를 선택하십시오.
프로세스 목록 위에있는 힙 업데이트를 클릭합니다.
오른쪽 패널에서 힙 탭을 선택합니다.
Cause GC를 클릭합니다.
프로세스 목록 위에있는 Dump HPROF 파일을 클릭합니다.
HPROF 파일을 다운로드 할 때 터미널을 열고이 명령을 실행하여 MAT로 열 수있는 파일을 생성해야합니다.
터미널을 열고이 명령을 실행하십시오.
./hprof-conv 경로 /file.hprof exitPath / heap-converted.hprof
"hprof-conv"명령은 sdk의 platform-tools 폴더에 있습니다.
- 그리고 ready 및 MAT는 변환 된 파일 (heap-converted.hprof)을 열고 열 수 있습니다.
할당을 보는 또 다른 방법이 있습니다.


Android 모니터-> 모니터 (logcat 옆)-> 메모리-> Java 힙 덤프
아래 단계를 제외하고 위 답변에 동의합니다.
프로세스 목록 위에있는 힙 업데이트를 클릭합니다.
오른쪽 패널에서 힙 탭을 선택합니다.
Cause GC를 클릭합니다.
DDMS에서 앱 / 프로세스를 선택하고 클릭하여 HPROF 프로필 옵션을 덤프하기 만하면됩니다. 그런 다음 위의 단계를 정확히 따르십시오.
더 많은 옵션을 얻기 위해 다음을 수행 할 수도 있습니다.
- 도구로 이동
- 그런 다음 Android로
- 마지막으로 Android Device Monitor로
First install MAT,in order to use it in Android Studio, you shall choose
Stand-alone Eclipse RCP Applicationsto install,which can be used as independent toolIn Android Studio , run your application
In the bottom-side panel, select
6:Android,then selectMemory MonitorClick
Dump Java HeapSwitch to the Captures tab (in the left-side panel), you can find the
.hproffile inHeap SnapshotfolderIn order to open the
.hproffile in MAT, you shall convert the format: left-click on the.hproffile, then chooseExport to standard .hprofOpen MAT, then open the
.hproffile that you have converted the format
Note that in the latest Android Studio (1.3+), the heap (Android hprof) capture has been moved to the Memory Monitor subtab under the Android tab (like the first image in cVoronin's answer).
When the capture is finished, it will be automatically saved to the "captures" directory under your project (you can rename the file after the fact if you wish). The hprof file will automatically be opened up in the new hprof viewer in 1.3+.
Of course, you always have the option to convert it to standard hprof format and view it in MAT. Just right click the file in the Captures browser (under the Project browser) and select convert there. And as usual, you'd lose some additional Android-specific information along the way by not using the new viewer, since standard hprof doesn't support those.
I switched from Eclipse to Android Studio, but I still use MAT in Eclipse, with the DDMS plugin. It's so much easier.
I know this is quite an old question, but Android Studio 3 has now a built in profiler.
여기 문서 참조 : Android Studio 3.0의 Android 프로파일 러
참고 URL : https://stackoverflow.com/questions/24547555/how-to-analyze-memory-using-android-studio
'Program Club' 카테고리의 다른 글
| 암호화 된 보안 토큰 생성 (0) | 2020.10.25 |
|---|---|
| Atom 편집기에서 * pyc 파일을 숨기는 방법 (0) | 2020.10.25 |
| 새로 고침 중에 SwipeRefreshLayout으로 조각을 전환하면 조각이 고정되지만 실제로는 여전히 작동합니다. (0) | 2020.10.25 |
| 해결 실패 : com.google.firebase : firebase-core : 11.2.0 (0) | 2020.10.25 |
| 이진 트리 vs. 연결 목록 vs. 해시 테이블 (0) | 2020.10.25 |
