You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ge...@apache.org on 2006/09/16 02:16:38 UTC
svn commit: r446791 -
/incubator/harmony/enhanced/drlvm/trunk/vm/thread/src/thread_ti_instr.c
Author: geirm
Date: Fri Sep 15 17:16:35 2006
New Revision: 446791
URL: http://svn.apache.org/viewvc?view=rev&rev=446791
Log:
HARMONY-1426
Array of monitors created by function GetOwnedMonitorsInfo can be freed with Deallocate JVMTI function. This array is
taken from Thread Manager by calling jthread_get_owned_monitors. But Thread Manager uses APR pools for allocating
memory for this array. So when JVMTI agent tries to use Deallocate on the array pointer the program usually crashes
since the pointer was not allocated by JVMTI Allocate.
Inside of JVMTI implementation Allocate simply calls malloc. So to solve this prooblem it is enough to change Thread
Manager allocator to malloc. I've done this fix in the same way as other functions in this file seem to be fixed.
Ugly tabs formatting is not fixed.
Modified:
incubator/harmony/enhanced/drlvm/trunk/vm/thread/src/thread_ti_instr.c
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/thread/src/thread_ti_instr.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/thread/src/thread_ti_instr.c?view=diff&rev=446791&r1=446790&r2=446791
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/thread/src/thread_ti_instr.c (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/thread/src/thread_ti_instr.c Fri Sep 15 17:16:35 2006
@@ -492,8 +492,8 @@
hythread_t tm_native_thread;
jvmti_thread_t tm_java_thread;
- apr_pool_t* pool;
- apr_status_t apr_status;
+ // apr_pool_t* pool;
+ // apr_status_t apr_status;
jobject* monitors;
int i;
IDATA status;
@@ -504,12 +504,13 @@
tm_native_thread = vm_jthread_get_tm_data(java_thread);
tm_java_thread = hythread_get_private_data(tm_native_thread);
assert(tm_java_thread);
- apr_status = apr_pool_create(&pool, 0);
+ /* apr_status = apr_pool_create(&pool, 0);
if (apr_status != APR_SUCCESS) {
hythread_global_unlock();
return TM_ERROR_INTERNAL;
}
- monitors = apr_palloc(pool, sizeof(jobject*) * tm_java_thread->owned_monitors_nmb);
+ monitors = apr_palloc(pool, sizeof(jobject*) * tm_java_thread->owned_monitors_nmb); */
+ monitors = (jobject *)malloc(sizeof(jobject*) * tm_java_thread->owned_monitors_nmb);
if (!monitors) {
hythread_global_unlock();
return TM_ERROR_OUT_OF_MEMORY;