LibGame v0.4.0
The LG Game Engine - Copyright (C) 2024-2026 ETMSoftware
Loading...
Searching...
No Matches
lg_mem.c File Reference

Functions

void * malloc2_plus (size_t size, const char *file, unsigned int line, const char *func)
 
void free2_plus (void *mem, const char *file, unsigned int line, const char *func)
 
void free_v2 (void **mem)
 

Detailed Description

 MEMORY MANAGEMENT

 malloc2/3() errors should end the program whereas free2/3() errors should not

 Plus, need to refactor all this -> confusing and too many different funcs

Function Documentation

◆ malloc2_plus()

void * malloc2_plus ( size_t  size,
const char *  file,
unsigned int  line,
const char *  func 
)

This is experimental - invoked by malloc3() macro

Test with malloc3((size_t)1024 * (size_t)(1024 * 1024 * 1024)), ie requiring 1 TiB of mem

◆ free2_plus()

void free2_plus ( void *  mem,
const char *  file,
unsigned int  line,
const char *  func 
)

This is experimental - invoked by free3() macro

◆ free_v2()

void free_v2 ( void **  mem)

NEW - needs testing

free() v2

Take pointer to pointer to mem arg, so that it can be nullified afterwards

Parameters
nmemPointer to pointer to mem block