RL.load and RL.unload functions for memory leak debugging. SoundAlias garbage collection.

This commit is contained in:
jussi
2025-05-24 23:56:42 +03:00
parent 913b8f8820
commit e26bb8603c
11 changed files with 316 additions and 59 deletions

18
API.md
View File

@@ -47,6 +47,18 @@ This function will be called before InitWindow. Note! Only place where you shoul
---
> function RL.load()
This function will be called when loading resource that allocates memory. Usefull for memory leak debugging. Note! Cannot detect all resources, for example material textures.
---
> function RL.unload()
This function will be called when unloading resource that has allocated memory. Usefull for memory leak debugging. Note! Cannot detect all resources, for example material textures.
---
## Object unloading
Some objects allocate memory that needs to be freed when object is no longer needed. By default objects like Textures are unloaded by the Lua garbage collector. It is generatty however recommended to handle this manually in more complex projects. You can change the behavior with SetGCUnload.
@@ -261,6 +273,12 @@ Sound
---
> SoundAlias = Userdata
SoundAlias
---
> Music = Userdata
Music, audio stream, anything longer than ~10 seconds should be streamed