Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions runtime/monotouch-main.m
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,8 @@ - (void) memoryWarning: (NSNotification *) sender

xamarin_mono_object_release (&assembly);

xamarin_release_static_dictionaries ();

xamarin_bridge_shutdown ();

return rv;
Expand Down
16 changes: 16 additions & 0 deletions runtime/runtime.m
Original file line number Diff line number Diff line change
Expand Up @@ -2070,6 +2070,22 @@ -(void) xamarinSetFlags: (enum XamarinGCHandleFlags) flags;
return rv;
}

void
xamarin_release_static_dictionaries ()
{
#if defined (CORECLR_RUNTIME)
// Release static dictionaries of cached objects. If we end up trying to
// add objects to these dictionaries after this point (on a background
// thread), the dictionaries will be re-created (and leak) - which
// shouldn't be a problem, because at this point the process is about to
// exit anyway.
pthread_mutex_lock (&wrapper_hash_lock);
xamarin_mono_object_release (&block_wrapper_queue);
xamarin_mono_object_release (&xamarin_wrapper_hash);
pthread_mutex_unlock (&wrapper_hash_lock);
#endif
}

void
xamarin_set_use_sgen (bool value)
{
Expand Down
1 change: 1 addition & 0 deletions runtime/xamarin/runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ bool xamarin_set_gchandle_with_flags_safe (id self, GCHandle gchandle, enum Xa
void xamarin_create_gchandle (id self, void *managed_object, enum XamarinGCHandleFlags flags, bool force_weak);
void xamarin_release_managed_ref (id self, bool user_type);
void xamarin_notify_dealloc (id self, GCHandle gchandle);
void xamarin_release_static_dictionaries ();

int xamarin_main (int argc, char *argv[], enum XamarinLaunchMode launch_mode);

Expand Down