[gs-cvs] rev 7098 - trunk/gs/src
stefan at ghostscript.com
stefan at ghostscript.com
Tue Oct 10 15:43:57 PDT 2006
Author: stefan
Date: 2006-10-10 15:43:56 -0700 (Tue, 10 Oct 2006)
New Revision: 7098
Modified:
trunk/gs/src/gsmalloc.c
Log:
Commenting out the memory wrappers retrying and locked.
This will obviously cause concern and testing for gs,
on the other hand it simplifies the memory allocations
and removes some significant issues with memory cleanup
when multiple jobs are run together in a language switch
environment.
Modified: trunk/gs/src/gsmalloc.c
===================================================================
--- trunk/gs/src/gsmalloc.c 2006-10-10 18:16:22 UTC (rev 7097)
+++ trunk/gs/src/gsmalloc.c 2006-10-10 22:43:56 UTC (rev 7098)
@@ -424,6 +424,7 @@
int
gs_malloc_wrap(gs_memory_t **wrapped, gs_malloc_memory_t *contents)
{
+#ifdef USE_RETRY_AND_LOCKING_MEMORY_WRAPPERS
gs_memory_t *cmem = (gs_memory_t *)contents;
gs_memory_locked_t *lmem = (gs_memory_locked_t *)
gs_alloc_bytes_immovable(cmem, sizeof(gs_memory_locked_t),
@@ -457,6 +458,7 @@
}
*wrapped = (gs_memory_t *)rmem;
+#endif
return 0;
}
@@ -464,18 +466,23 @@
gs_malloc_memory_t *
gs_malloc_wrapped_contents(gs_memory_t *wrapped)
{
+#ifdef USE_RETRY_AND_LOCKING_MEMORY_WRAPPERS
gs_memory_retrying_t *rmem = (gs_memory_retrying_t *)wrapped;
gs_memory_locked_t *lmem =
(gs_memory_locked_t *)gs_memory_retrying_target(rmem);
if (lmem)
return (gs_malloc_memory_t *)gs_memory_locked_target(lmem);
return (gs_malloc_memory_t *) wrapped;
+#else
+ return (gs_malloc_memory_t *)wrapped;
+#endif
}
/* Free the wrapper, and return the wrapped contents. */
gs_malloc_memory_t *
gs_malloc_unwrap(gs_memory_t *wrapped)
{
+#ifdef USE_RETRY_AND_LOCKING_MEMORY_WRAPPERS
gs_memory_retrying_t *rmem = (gs_memory_retrying_t *)wrapped;
gs_memory_locked_t *lmem =
(gs_memory_locked_t *)gs_memory_retrying_target(rmem);
@@ -485,6 +492,9 @@
gs_memory_locked_release(lmem);
gs_free_object(contents, lmem, "gs_malloc_unwrap(locked)");
return (gs_malloc_memory_t *)contents;
+#else
+ return (gs_malloc_memory_t *)wrapped;
+#endif
}
@@ -500,7 +510,11 @@
else
gs_lib_ctx_init((gs_memory_t *)malloc_memory_default);
+#ifdef USE_RETRY_AND_LOCKING_MEMORY_WRAPPERS
gs_malloc_wrap(&memory_t_default, malloc_memory_default);
+#else
+ memory_t_default = (gs_memory_t *)malloc_memory_default;
+#endif
memory_t_default->stable_memory = memory_t_default;
return memory_t_default;
}
@@ -509,6 +523,6 @@
void
gs_malloc_release(gs_memory_t *mem)
{
- gs_malloc_memory_t * malloc_memory_default = gs_malloc_unwrap(mem);
+ gs_malloc_memory_t * malloc_memory_default = mem; // gs_malloc_unwrap(mem);
gs_malloc_memory_release(malloc_memory_default);
}
More information about the gs-cvs
mailing list