aui-framework / aui-framework/aui

Handle low memory event

Open
#429 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
598
Forks
44
Avg merge
17h 56m
Merged PRs (30d)
3

Description

### Describe the need of your project

Modern OSes provide a way to handle high memory pressure. We'd like to handle such event. Also, it would be useful if AUI would print this signal emission to logs by default. AUI has several caches for textures, sounds, etc... so they can subscribe to this signal as well.

### Proposed solution

Make global `AObject` like `ASharedApplication` with signal `lowMemoryNotified`. The underlying implementations:

- Windows: [CreateMemoryResourceNotification](https://learn.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-creatememoryresourcenotification)
- Linux: [/sys/fs/cgroup/memory/memory.pressure_level](https://www.kernel.org/doc/Documentation/cgroup-v1/memory.txt) fd
- macOS: [simulating low memory condition](https://stackoverflow.com/questions/54531898/how-do-you-simulate-low-memory-conditions-under-macos)
- Android: [onTrimMemory](https://developer.android.com/topic/performance/memory), [onLowMemory](https://developer.android.com/reference/android/app/Application.html#onLowMemory%28%29)
- iOS: [UIKit didReceiveMemoryWarning](https://developer.apple.com/documentation/uikit/responding-to-memory-warnings)

### Alternatives you've considered

_No response_

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by tracing the existing ASharedApplication and AObject entry points, then compare how the proposed Windows, Linux, macOS, Android, and iOS memory-pressure APIs could feed the lowMemoryNotified signal. Done means the signal is emitted and logged by default on supported platforms, with AUI caches able to subscribe to it.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, cpp, ios, linux, macos
Domain
desktop, mobile, operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.