Free memory associated with the trace descriptor of ALL dropped JIT work orders
To further reduce the memory consumption only enable the method vs trace
compile size stats when WITH_JIT_TUNING is configured.
diff --git a/vm/compiler/Compiler.c b/vm/compiler/Compiler.c
index e01ca89..032b859 100644
--- a/vm/compiler/Compiler.c
+++ b/vm/compiler/Compiler.c
@@ -53,6 +53,9 @@
* Attempt to enqueue a work order, returning true if successful.
* This routine will not block, but simply return if it couldn't
* aquire the lock or if the queue is full.
+ *
+ * NOTE: Make sure that the caller frees the info pointer if the return value
+ * is false.
*/
bool dvmCompilerWorkEnqueue(const u2 *pc, WorkOrderKind kind, void* info)
{
@@ -62,11 +65,6 @@
bool result = true;
if (dvmTryLockMutex(&gDvmJit.compilerLock)) {
- /*
- * Make sure the memory associated with the info pointer is freed for
- * dropped work orders.
- */
- free(info);
return false; // Couldn't acquire the lock
}
@@ -315,8 +313,10 @@
dvmLockMutex(&gDvmJit.compilerLock);
+#if defined(WITH_JIT_TUNING)
/* Track method-level compilation statistics */
gDvmJit.methodStatsTable = dvmHashTableCreate(32, NULL);
+#endif
dvmUnlockMutex(&gDvmJit.compilerLock);