Skip to content

Add low memory alarm system#310

Open
iProgramMC wants to merge 3 commits into
ButterscotchRunner:mainfrom
iProgramMC:memory-pressure-optimization
Open

Add low memory alarm system#310
iProgramMC wants to merge 3 commits into
ButterscotchRunner:mainfrom
iProgramMC:memory-pressure-optimization

Conversation

@iProgramMC

@iProgramMC iProgramMC commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

lowMemoryAlarm() should be called when memory pressure is detected. An example is if safeMalloc() and friends start returning NULL instead of a proper memory region.

To register a callback, which will evict some amount of evictable cached data (and will be called multiple times if required), use registerLowMemoryAlarmCallback.

lowMemoryAlarm() can be called in other places, for example, with iOS' low memory signal.

This PR also adds LIKELY() and UNLIKELY() macros, which are hints to the compiler that it should prioritize a code branch or another during generation (if supported).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant