Skip to content

Commit

Permalink
[dmlab_connect, egl_glimp] Unload graphics-related modules when the e…
Browse files Browse the repository at this point in the history
…nvironment 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.
  • Loading branch information
tkoeppe committed Apr 18, 2018
1 parent 4ab113d commit 467f2de
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions engine/code/deepmind/dmlab_connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "../qcommon/q_shared.h"
#include "../qcommon/qcommon.h"
#include "../renderercommon/qgl.h"
#include "../renderercommon/tr_common.h"
#include "../sys/sys_local.h"

static const double kPixelsPerFrameToDegreesPerMilliseconds = 0.11 * 60 / 1000;
Expand Down Expand Up @@ -1128,6 +1129,7 @@ static void dmlab_destroy_context(void* context) {
free(gc->image_buffer);
free(gc);
DMLabUnloadIOQ3Module();
GLimp_Shutdown();
}

static void call_add_score(int player_id, double score) {
Expand Down
1 change: 1 addition & 0 deletions engine/code/deepmind/headless_egl_glimp.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,5 @@ void GLimp_Shutdown(void) {
CHECK_EGL_SUCCESS(eglDestroySurface(egl_display, egl_surface));
CHECK_EGL_SUCCESS(eglDestroyContext(egl_display, egl_context));
CHECK_EGL_SUCCESS(TerminateInitializedEGLDisplay(egl_display));
ShutDownEGLSubsystem();
}

0 comments on commit 467f2de

Please sign in to comment.