Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[sgen] MONO_GC_DEBUG option for disabling the managed allocator.

This can be used to make all object allocations show up in the dtrace probe.
  • Loading branch information...
commit a520276c76fed3f136658b16995c3182be7dc643 1 parent d33ff74
Mark Probst schani authored
3  man/mono.1
@@ -1189,6 +1189,9 @@ Don't do major collections.
1189 1189 Forces the GC to scan the stack conservatively, even if precise
1190 1190 scanning is available.
1191 1191 .TP
  1192 +\fBno-managed-allocator\fR
  1193 +Disables the managed allocator.
  1194 +.TP
1192 1195 \fBcheck-scan-starts\fR
1193 1196 If set, does a plausibility check on the scan_starts before and after each collection
1194 1197 .TP
11 mono/metadata/sgen-alloc.c
@@ -69,6 +69,8 @@ enum {
69 69
70 70 #undef OPDEF
71 71
  72 +static gboolean use_managed_allocator = TRUE;
  73 +
72 74 #ifdef HEAVY_STATISTICS
73 75 static long long stat_objects_alloced = 0;
74 76 static long long stat_bytes_alloced = 0;
@@ -986,12 +988,21 @@ mono_gc_get_managed_array_allocator (MonoVTable *vtable, int rank)
986 988 #endif
987 989 }
988 990
  991 +void
  992 +sgen_set_use_managed_allocator (gboolean flag)
  993 +{
  994 + use_managed_allocator = flag;
  995 +}
  996 +
989 997 MonoMethod*
990 998 mono_gc_get_managed_allocator_by_type (int atype)
991 999 {
992 1000 #ifdef MANAGED_ALLOCATION
993 1001 MonoMethod *res;
994 1002
  1003 + if (!use_managed_allocator)
  1004 + return NULL;
  1005 +
995 1006 if (!mono_runtime_has_tls_get ())
996 1007 return NULL;
997 1008
11 mono/metadata/sgen-gc.c
@@ -4541,6 +4541,8 @@ mono_gc_base_init (void)
4541 4541 do_verify_nursery = TRUE;
4542 4542 } else if (!strcmp (opt, "dump-nursery-at-minor-gc")) {
4543 4543 do_dump_nursery_content = TRUE;
  4544 + } else if (!strcmp (opt, "no-managed-allocator")) {
  4545 + sgen_set_use_managed_allocator (FALSE);
4544 4546 } else if (!strcmp (opt, "disable-minor")) {
4545 4547 disable_minor_collections = TRUE;
4546 4548 } else if (!strcmp (opt, "disable-major")) {
@@ -4568,12 +4570,21 @@ mono_gc_base_init (void)
4568 4570 fprintf (stderr, " verify-before-allocs[=<n>]\n");
4569 4571 fprintf (stderr, " check-at-minor-collections\n");
4570 4572 fprintf (stderr, " verify-before-collections\n");
  4573 + fprintf (stderr, " verify-nursery-at-minor-gc\n");
  4574 + fprintf (stderr, " dump-nursery-at-minor-gc\n");
4571 4575 fprintf (stderr, " disable-minor\n");
4572 4576 fprintf (stderr, " disable-major\n");
4573 4577 fprintf (stderr, " xdomain-checks\n");
4574 4578 fprintf (stderr, " clear-at-gc\n");
  4579 + fprintf (stderr, " clear-nursery-at-gc\n");
  4580 + fprintf (stderr, " check-scan-starts\n");
  4581 + fprintf (stderr, " no-managed-allocator\n");
4575 4582 fprintf (stderr, " print-allowance\n");
4576 4583 fprintf (stderr, " print-pinning\n");
  4584 + fprintf (stderr, " heap-dump=<filename>\n");
  4585 +#ifdef SGEN_BINARY_PROTOCOL
  4586 + fprintf (stderr, " binary-protocol=<filename>\n");
  4587 +#endif
4577 4588 exit (1);
4578 4589 }
4579 4590 }
1  mono/metadata/sgen-gc.h
@@ -1028,6 +1028,7 @@ typedef enum {
1028 1028
1029 1029 void sgen_init_tlab_info (SgenThreadInfo* info);
1030 1030 void sgen_clear_tlabs (void);
  1031 +void sgen_set_use_managed_allocator (gboolean flag);
1031 1032 gboolean sgen_is_managed_allocator (MonoMethod *method);
1032 1033 gboolean sgen_has_managed_allocator (void);
1033 1034

0 comments on commit a520276

Please sign in to comment.
Something went wrong with that request. Please try again.