Skip to content

Commit 467f2de

Browse files
committed
[dmlab_connect, egl_glimp] Unload graphics-related modules when the environment is destroyed.
In simply-linked applications, the graphics modules merely leave "still reachable" allocations behind. But when we load and unload the engine via the DSO loader, those allocations become actual leaks, so there is some value in minimizing them.
1 parent 4ab113d commit 467f2de

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

engine/code/deepmind/dmlab_connect.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include "../qcommon/q_shared.h"
3535
#include "../qcommon/qcommon.h"
3636
#include "../renderercommon/qgl.h"
37+
#include "../renderercommon/tr_common.h"
3738
#include "../sys/sys_local.h"
3839

3940
static const double kPixelsPerFrameToDegreesPerMilliseconds = 0.11 * 60 / 1000;
@@ -1128,6 +1129,7 @@ static void dmlab_destroy_context(void* context) {
11281129
free(gc->image_buffer);
11291130
free(gc);
11301131
DMLabUnloadIOQ3Module();
1132+
GLimp_Shutdown();
11311133
}
11321134

11331135
static void call_add_score(int player_id, double score) {

engine/code/deepmind/headless_egl_glimp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,5 @@ void GLimp_Shutdown(void) {
9999
CHECK_EGL_SUCCESS(eglDestroySurface(egl_display, egl_surface));
100100
CHECK_EGL_SUCCESS(eglDestroyContext(egl_display, egl_context));
101101
CHECK_EGL_SUCCESS(TerminateInitializedEGLDisplay(egl_display));
102+
ShutDownEGLSubsystem();
102103
}

0 commit comments

Comments
 (0)