From 815b39a08a8e4a64096b50034a4768d371b928a5 Mon Sep 17 00:00:00 2001 From: Shariq Shah Date: Sat, 18 Apr 2020 20:52:53 +1000 Subject: [PATCH] Fixed long standing memory leak by using nk_buffer_clear each frame --- assets/scenes/scene_1.symtres | 24 ++++++++++++++++++++++++ src/common/version.h | 2 +- src/game/gui.c | 1 + todo.txt | 4 +++- 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/assets/scenes/scene_1.symtres b/assets/scenes/scene_1.symtres index b9a1353..840c833 100755 --- a/assets/scenes/scene_1.symtres +++ b/assets/scenes/scene_1.symtres @@ -93,6 +93,30 @@ Entity bounding_box_max : 0.500 0.500 0.500 } +Entity +{ + type : 5 + scale : 1.000 1.000 1.000 + inner_angle : 20.0000 + falloff : 0.9500 + light_type : 2 + depth_bias : 0.0005 + rotation : 0.000 0.000 0.000 1.000 + cast_shadow : false + intensity : 1.0000 + color : 1.000 1.000 1.000 + radius : 14.0000 + position : -9.000 6.000 -42.000 + flags : 1 + outer_angle : 30.0000 + name : Test_Light + archetype : spot + bounding_box_min : -0.500 -0.500 -0.500 + pcf_enabled : false + valid : true + bounding_box_max : 0.500 0.500 0.500 +} + Entity { type : 6 diff --git a/src/common/version.h b/src/common/version.h index cd44a0d..e8c8fce 100755 --- a/src/common/version.h +++ b/src/common/version.h @@ -4,7 +4,7 @@ /* Auto generated version file. DO NOT MODIFY */ #define SYMMETRY_VERSION_MAJOR 0 #define SYMMETRY_VERSION_MINOR 3 -#define SYMMETRY_VERSION_REVISION 372 +#define SYMMETRY_VERSION_REVISION 373 #define SYMMETRY_VERSION_BRANCH "dev" #endif \ No newline at end of file diff --git a/src/game/gui.c b/src/game/gui.c index 4cc109e..fa954f3 100755 --- a/src/game/gui.c +++ b/src/game/gui.c @@ -239,6 +239,7 @@ void gui_render(struct Gui* gui, enum nk_anti_aliasing AA) offset += cmd->elem_count; } nk_clear(&gui->context); + nk_buffer_clear(&gui->commands); } shader_unbind(); diff --git a/todo.txt b/todo.txt index e7a3817..47c245a 100644 --- a/todo.txt +++ b/todo.txt @@ -1,4 +1,5 @@ Todo: + - Fix frustum culling on player camera - Don't save parent entity's transform when saving entity archetype. Only save the transformation values for children - Save case sensitive file names when scene entity entries - Disbale all player actions when scene cleared dialog or scene restart dialog are active @@ -430,4 +431,5 @@ Done: * Memory utils that provide allocation tracking * Game End * Save NONE when next_scene is not set and the scene is being saved - * Add player start entity that specifies where the player must start at the beginning of every level \ No newline at end of file + * Add player start entity that specifies where the player must start at the beginning of every level + * Fixed memory leak \ No newline at end of file