coastline 0.0.4
Loading...
Searching...
No Matches
memorybudget.h File Reference
#include <stdint.h>
Include dependency graph for memorybudget.h:

Go to the source code of this file.

Functions

int InitializeSampleMemoryBudget (void)
 Initialise a sample budget from available Windows page-file capacity or SDL system RAM.
uint32_t GetSampleMemoryLimit (void)
uint32_t GetSampleMemoryUsed (void)
int __stdcall ReserveSampleMemory (uint32_t bytes)
 Account for a reservation without allocating memory.
void __stdcall ReleaseSampleMemory (uint32_t bytes)
 Subtract released storage from tracked usage without freeing memory or checking underflow.
int __stdcall SetSampleMemoryLimit (uint32_t bytes)
 Change the budget limit only when the requested limit does not exceed current usage.

Function Documentation

◆ InitializeSampleMemoryBudget()

int InitializeSampleMemoryBudget ( void )

Initialise a sample budget from available Windows page-file capacity or SDL system RAM.

Repeated calls preserve an established budget and current usage.

Returns
One on success; zero with EAR error 0x10 when available capacity is below 512000 bytes.
Ghidra address:
EAR: 0x10008bb0

◆ GetSampleMemoryLimit()

uint32_t GetSampleMemoryLimit ( void )
Returns
The configured sample-memory limit in bytes.
Ghidra address:
EAR: 0x10008ca2

◆ GetSampleMemoryUsed()

uint32_t GetSampleMemoryUsed ( void )
Returns
The tracked reserved sample-memory byte count.
Ghidra address:
EAR: 0x10008cac

◆ ReserveSampleMemory()

int __stdcall ReserveSampleMemory ( uint32_t bytes)

Account for a reservation without allocating memory.

Native addition wraps at 32 bits before comparison with the limit.

Parameters
bytesThe requested byte count to add to current usage.
Returns
One when wrapped total usage does not exceed the limit; zero with usage unchanged.
Ghidra address:
EAR: 0x10008cb6

◆ ReleaseSampleMemory()

void __stdcall ReleaseSampleMemory ( uint32_t bytes)

Subtract released storage from tracked usage without freeing memory or checking underflow.

Parameters
bytesThe byte count to subtract using unsigned 32-bit arithmetic.
Ghidra address:
EAR: 0x10008ce6

◆ SetSampleMemoryLimit()

int __stdcall SetSampleMemoryLimit ( uint32_t bytes)

Change the budget limit only when the requested limit does not exceed current usage.

Parameters
bytesThe requested limit in bytes.
Returns
One when the limit is stored; zero with the limit unchanged when bytes exceeds usage.
Ghidra address:
EAR: 0x10008cfa