mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-15 01:25:20 +02:00
Move malloc_trim invocations to background thread (#14744)
This commit is contained in:
@@ -290,15 +290,22 @@ void osSpecificInit();
|
||||
// This attaches to the parents process console, or creates a new one if it doesnt exist.
|
||||
void attachOrCreateConsole();
|
||||
|
||||
#if HAVE_MALLOC_TRIM
|
||||
/**
|
||||
* Call this after freeing bigger blocks of memory. Used on some platforms to
|
||||
* properly give memory back to the OS.
|
||||
* @param amount Number of bytes freed
|
||||
*/
|
||||
#if HAVE_MALLOC_TRIM
|
||||
void TrackFreedMemory(size_t amount);
|
||||
|
||||
/**
|
||||
* Call this regularly from background threads. This performs the actual trimming
|
||||
* and is potentially slow.
|
||||
*/
|
||||
void TriggerMemoryTrim();
|
||||
#else
|
||||
inline void TrackFreedMemory(size_t amount) { (void)amount; }
|
||||
static inline void TrackFreedMemory(size_t amount) { (void)amount; }
|
||||
static inline void TriggerMemoryTrim() { (void)0; }
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
|
Reference in New Issue
Block a user