[gs-code-review]
Memory leak from API calls (688181, ref: 688599) |
Ray Johnston
ray.johnston at artifex.com
Thu May 18 10:14:24 PDT 2006
Reviewers,
I suspect that the memory leak reported in 688181 is due to the
missing gs_malloc_release call in gsapi_delete_instance.
Does anyone have any comments on the patch below?
If not, I'll commit it.
--- src/iapi.c (revision 6784)
+++ src/iapi.c (working copy)
@@ -99,19 +99,19 @@
{
gs_lib_ctx_t *ctx = (gs_lib_ctx_t *)lib;
if ((ctx != NULL)) {
+ gs_main_instance *minst = get_minst_from_memory(ctx->memory);
+
ctx->caller_handle = NULL;
ctx->stdin_fn = NULL;
ctx->stdout_fn = NULL;
ctx->stderr_fn = NULL;
ctx->poll_fn = NULL;
- get_minst_from_memory(ctx->memory)->display = NULL;
+ minst->display = NULL;
- /* NB: notice how no deletions are occuring, good bet this isn't thread ready
- */
+ /* Release the memory (frees up everything) */
+ gs_malloc_release(minst->heap);
--gsapi_instance_counter;
-
-
}
}
Regards,
Ray
_______________________________________________________________________
More information about the gs-code-review
mailing list