Bug 9569 - [Boehm] tracking weakreferences leaks memory
Summary: [Boehm] tracking weakreferences leaks memory
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: GC ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-01-15 08:51 UTC by Rolf Bjarne Kvinge [MSFT]
Modified: 2013-05-15 17:00 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
test.cs (845 bytes, application/octet-stream)
2013-01-15 08:51 UTC, Rolf Bjarne Kvinge [MSFT]
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Rolf Bjarne Kvinge [MSFT] 2013-01-15 08:51:32 UTC
Created attachment 3219 [details]
test.cs

Repro:
    Compile & run the provided test case.
    Use Instruments to take periodic snapshots. Watch how memory usage increases as time goes by.

The leak is here (this is from mono 56275bc16bf2ab007ae7f943ffe746dadde27dc1):

   0 libsystem_c.dylib malloc
   1 mono monoeg_malloc /mono/ios/mono-branches/public-master/eglib/src/gmem.c:73
   2 mono monoeg_g_hash_table_insert_replace /mono/ios/mono-branches/public-master/eglib/src/ghashtable.c:258
   3 mono mono_gc_change_weak_track_handle /mono/ios/mono-branches/public-master/mono/metadata/boehm-gc.c:629
   4 mono mono_gc_run_finalize /mono/ios/mono-branches/public-master/mono/metadata/gc.c:144
   5 mono GC_invoke_finalizers /mono/ios/mono-branches/public-master/libgc/finalize.c:787
   6 mono finalizer_thread /mono/ios/mono-branches/public-master/mono/metadata/gc.c:1138
   7 mono start_wrapper /mono/ios/mono-branches/public-master/mono/metadata/threads.c:589
   8 mono thread_start_routine /mono/ios/mono-branches/public-master/mono/io-layer/wthreads.c:286
   9 mono inner_start_thread /mono/ios/mono-branches/public-master/mono/utils/mono-threads-posix.c:49
  10 mono GC_start_routine /mono/ios/mono-branches/public-master/libgc/pthread_support.c:1510
  11 libsystem_c.dylib _pthread_start
  12 libsystem_c.dylib thread_start

The problem is that objects aren't removed from domain->track_resurrection_objects_hash (they're removed in the dtor, but the immediately readded. Since the dtor is only executed once, they're not re-removed).

This only happens with boehm, not sgen.
Comment 1 Rodrigo Kumpera 2013-01-16 16:30:31 UTC
Fixed on master, let's leave it there for some time before we promote to stable.
Comment 2 Rodrigo Kumpera 2013-05-15 17:00:31 UTC
Done.