The Memory Advice API beta is now deprecated, and no longer recommended for use.
Memory Advice API 개요
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
Memory Advice API는 Android 앱이 메모리 사용량의 안전 한계를 넘지 않도록 도와주는 실험용 네이티브 API입니다. 이를 위해 사용 중인 메모리 리소스의 양을 추정하고 특정 기준점을 초과하면 앱에 알립니다. API는 예상 메모리 사용량 비율을 앱에 직접 보고할 수도 있습니다.
API에서 제공하는 추정치는 앱이 메모리 사용량을 조정해야 하는 시점을 판단하거나 앱의 향후 버전에서 개선할 영역을 찾는 데 도움이 됩니다. 조정할 부분으로는 시각적 애셋과 오디오 애셋의 세부정보와 품질을 낮추는 등 메모리 소비를 변경하는 모든 작업이 포함될 수 있습니다.
예상 메모리 리소스에는 malloc에서 할당된 네이티브 힙 메모리와 OpenGL ES 및 Vulkan Graphics API에서 할당된 그래픽 메모리가 포함되어 있으므로 Memory Advice API는 게임 및 그래픽이 많은 앱에 적합합니다.
추정치는 다음에 기반하여 산출됩니다.
- API에서 수집하는 기기 측정항목
- 기기의 머신러닝 데이터
- 기기 테스트
API 수준에서 Memory Advice API는 메모리 조언 상태 집합을 정의하고 일련의 함수를 사용하여 앱에 조언 상태를 전달합니다.
시작하기
Unity 게임 시작하기
배포
Memory Advice API는 Android Game Development Kit(AGDK)의 일부이며, 다음 채널을 통해 배포됩니다.
게임은 빌드 환경에 권장되는 Memory Advice API 버전을 사용해야 합니다. Android 스튜디오의 경우 Jetpack 버전을 사용하는 것이 좋습니다. Android 게임 개발 확장 프로그램(AGDE)의 경우 AGDK 다운로드 페이지에 있는 버전을 사용하는 것이 좋습니다.
기능
이 섹션에서는 Memory Advice API 기능을 설명합니다.
메모리 상태
API는 앱에 다음 메모리 상태를 보고합니다.
- MEMORYADVICE_STATE_OK
- MEMORYADVICE_STATE_APPROACHING_LIMIT
- MEMORYADVICE_STATE_CRITICAL
자세한 내용은 memoryadvice_memorystate 참조 페이지를 확인하세요.
메모리 상태 보고
이 API는 폴링 또는 콜백 메커니즘을 통해 메모리 상태를 보고합니다.
폴링:
앱에서 언제든지 API를 호출하여 메모리 상태를 가져올 수 있습니다.
콜백:
앱에서 Memory Advice API를 사용하여 콜백 함수를 등록할 수 있습니다.
앱이 콜백의 호출 빈도를 지정합니다. API는 빈도를 사용하여 애플리케이션 메모리 조건이 안전 한계에 가까워지거나 매우 낮을 때 콜백을 실행할 시점을 결정합니다. 메모리 조건이 안전한 경우에는 콜백이 호출되지 않습니다. 콜백은 앱에 속한 스레드가 아니라 자체 스레드에서 실행됩니다.
비용 및 호출 빈도 고려사항
Memory Advice API는 메모리 상태를 생성하기 위해 계산 시간을 사용합니다. 비용은 기기에 따라 다르지만, 일반적으로 호출당 1~3밀리초가 듭니다. 메모리 상태의 폴링 주기 또는 메모리 상태 콜백에 지정할 빈도를 결정할 때 이 오버헤드를 고려해야 합니다.
요구사항
기기 요구사항
- Android 4.4(API 수준 19) 이상
앱 요구사항
NDK 버전 요구사항
Memory Advice API 버전은 많이 사용되는 NDK 버전을 대부분 지원합니다. 지원되는 NDK 목록은 출시 노트를 참고하세요.
추가 리소스
문제 및 의견
Memory Advice API는 베타 버전이며 여러분의 의견을 환영합니다. API를 사용하는 동안 제안사항이 있거나 문제가 발생하면 IssueTracker에서 문제를 생성하세요.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-08-26(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-08-26(UTC)"],[],[],null,["| **Note:** The Memory Advice API Beta is now over and the library is deprecated. [learn more about alternative memory management approaches](/games/optimize/memory-allocation).\n\nThe Memory Advice API is an experimental native API that\nhelps Android apps stay within safety limits for memory use. The API\nachieves this by estimating the amount of memory resources that are in use, and\nthen notifying the app when certain thresholds are exceeded. The API can\nalso report the estimated percentage of memory use directly to your app.\n\nThe estimations provided by the API help to determine when your app should\nadjust its memory use, or to find areas to improve in future versions of your\napp. The adjustments could include anything that changes memory consumption, such\nas lowering the details and quality of visual and audio assets.\n\nThe estimated memory resources include native heap memory allocated by malloc,\nand graphics memory allocated by the OpenGL ES and Vulkan Graphics APIs making\nthe Memory Advice API ideal for games and graphic intensive apps.\n\nThe estimates are made based on the following:\n\n- Device metrics collected by the API\n- Machine learning data from devices\n- Device testing\n\nAt the API level, the Memory Advice API defines a set of memory\nadvice states and communicates them to apps with a set of functions.\n\n[Get Started](/games/sdk/memory-advice/start)\n[Get Started for Unity games](/games/engines/unity/memory-advice)\n\nDistributions\n\nThe Memory Advice API is a part of the Android Games Development\nKit (AGDK) and is distributed through the following channels:\n\n- Binary releases in the [Android Games Jetpack libraries](/jetpack/androidx/releases/games).\n- Binary releases on the [AGDK download page](/games/agdk/get-agdk#agdk-libraries).\n- Source code on [AOSP](https://android.googlesource.com/platform/frameworks/opt/gamesdk/+/refs/heads/master/test/memoryadvice).\n\nGames should use the Memory Advice API release that is\nrecommended for their build environment. For Android Studio, we recommend the\nJetpack release. For the [Android Game Development Extension](/games/agde)\n(AGDE), we recommend the release on the AGDK download page.\n\nFeatures\n\nThis section describes the Memory Advice API features.\n\nMemory state\n\nThe API reports the following memory states to apps:\n\n- MEMORYADVICE_STATE_OK\n- MEMORYADVICE_STATE_APPROACHING_LIMIT\n- MEMORYADVICE_STATE_CRITICAL\n\nFor details, see the [memoryadvice_memorystate](/reference/games/memory-advice/group/memory-advice#memoryadvice_memorystate) reference pages.\n\nReporting the memory state\n\nThe API supports reporting the memory state through either a polling or a callback mechanism:\n\n- **Polling** : \n\n An app can call the API at any time to retrieve the memory state.\n\n- **Callback** : \n\n An app can register a callback function with the Memory Advice API.\n The app specifies the calling frequency for the callback. The API\n uses the frequency to determine when to execute the callback when the application memory\n condition is approaching the safe limit or is critically low. The callback is not invoked\n if the memory condition is safe. The callback is executed from its own thread,\n not from a thread belonging to the app.\n\nCost and calling frequency considerations\n\nThe Memory Advice API uses computational time to generate\nthe memory status. The cost varies by device, but is usually between 1ms and 3ms\nper call. You should consider this overhead when determining how often\nto poll the memory state, or what frequency to specify for the memory state callback.\n\nRequirements\n\n**Device requirements**\n\n- Android 4.4 (API level 19) or higher.\n\n**App requirements**\n\n- The API only supports native apps (apps primarily written in C/C++).\n\n- The API only supports physical devices; emulators are not supported.\n\n**NDK version requirements**\n\nThe Memory Advice API release supports most popular NDK versions,\nrefer to the [release notes](https://developer.android.com/jetpack/androidx/releases/games)\nfor the supported NDK list.\n| **Note:** Addition versions of the NDK are supported by [the full AGDK library](/games/agdk/get-agdk#agdk-libraries).\n\nAdditional Resources\n\n- [Memory Advice API release notes](https://developer.android.com/jetpack/androidx/releases/games)\n- [Memory Advice API reference documentation](/reference/games/memory-advice/group/memory-advice)\n- [Memory Advice sample on GitHub](https://github.com/android/games-samples/blob/main/agdk/agdktunnel/app/src/main/cpp/memory_consumer.cpp#L168)\n- [Memory Advice API source code](https://android.googlesource.com/platform/frameworks/opt/gamesdk/+/refs/heads/master/games-memory-advice/)\n\nIssues and Feedback\n\nThe Memory Advice API is in beta and welcomes feedback, if you have suggestions or\nfind issues while using the API, [create an issue in IssueTracker](https://issuetracker.google.com/issues/new?component=897320&template=1456805)."]]