From: Jay Krell Date: Sat, 31 Aug 2019 18:46:33 +0000 (-0700) Subject: Tweak names and fix preexisting leak under low memory. X-Git-Tag: submit/tizen/20210909.063632~10331^2~5^2~583 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9e24778e9f944586fda0a00fd0fb7e49b4c0fd35;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Tweak names and fix preexisting leak under low memory. Commit migrated from https://github.com/mono/mono/commit/a55da2a9036199c5c18442f465c4fd007c136e62 --- diff --git a/src/mono/mono/metadata/threads.c b/src/mono/mono/metadata/threads.c index 79dae03..caa28c9 100644 --- a/src/mono/mono/metadata/threads.c +++ b/src/mono/mono/metadata/threads.c @@ -4097,6 +4097,11 @@ mono_threads_perform_thread_dump (void) void ves_icall_System_Threading_Thread_GetStackTraces (MonoArrayHandleOut out_threads_handle, MonoArrayHandleOut out_stack_frames_handle, MonoError *error) { + MONO_HANDLE_ASSIGN_RAW (out_threads_handle, NULL); + MONO_HANDLE_ASSIGN_RAW (out_stack_frames_handle, NULL); + + guint32 handle = 0; + MonoStackFrameHandle stack_frame_handle = MONO_HANDLE_NEW (MonoStackFrame, NULL); MonoReflectionMethodHandle reflection_method_handle = MONO_HANDLE_NEW (MonoReflectionMethod, NULL); MonoStringHandle filename_handle = MONO_HANDLE_NEW (MonoString, NULL); @@ -4130,7 +4135,8 @@ ves_icall_System_Threading_Thread_GetStackTraces (MonoArrayHandleOut out_threads for (tindex = 0; tindex < nthreads; ++tindex) { - guint32 handle = thread_array [tindex]; + mono_gchandle_free_internal (handle); + handle = thread_array [tindex]; MonoInternalThread *thread = (MonoInternalThread *) mono_gchandle_get_target_internal (handle); MonoArray *thread_frames; @@ -4194,9 +4200,11 @@ ves_icall_System_Threading_Thread_GetStackTraces (MonoArrayHandleOut out_threads } mono_gchandle_free_internal (handle); + handle = 0; } leave: + mono_gchandle_free_internal (handle); g_free (ud.frames); }