raysan5 / raylib

A simple and easy-to-use library to enjoy videogames programming
http://www.raylib.com
zlib License
21.95k stars 2.22k forks source link

[rlgl] Memory leak regarding meshes #1603

Closed Crydsch closed 3 years ago

Crydsch commented 3 years ago

In models.h all GenMesh* methods allocate memory for mesh.vboId. But in rlgl.h in the method rlUnloadMesh() there is no RL_FREE(mesh.vboId).

Crydsch commented 3 years ago

I just found this function in model.h, so there its taken care of, but i guess it should be in rlgl.h.

// Unload mesh from memory (RAM and/or VRAM)
void UnloadMesh(Mesh mesh)
{
    rlUnloadMesh(mesh);
    RL_FREE(mesh.vboId);
}
raysan5 commented 3 years ago

Reviewed on latest commit, now every module (rlgl, models) takes care of the corresponding loaded data. models takes care of loading/unloading vertex data and rlgl takes cares of OpenGL related data.