Patchwork Add various constants to malloc_info output.

login
register
mail settings
Submitter DJ Delorie
Date May 14, 2019, 12:23 a.m.
Message ID <xnv9yddguo.fsf@greed.delorie.com>
Download mbox | patch
Permalink /patch/32666/
State New
Headers show

Comments

DJ Delorie - May 14, 2019, 12:23 a.m.
Florian Weimer <fw@deneb.enyo.de> writes:
> I think this needs to be conditional on USE_TCACHE.

Conditionaled wrt the constant being printed.  I think this is a more
sensible rule for this type of "all constants" logic - it makes the list
and its conditionals independent of when they get defined.

	* malloc/malloc.c (__malloc_info): Add various constants to the
	output.

Patch

diff --git a/malloc/malloc.c b/malloc/malloc.c
index b8baaa2706..3a83523fb6 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -5387,6 +5387,18 @@  __malloc_info (int options, FILE *fp)
 
   fputs ("<malloc version=\"1\">\n", fp);
 
+  fprintf (fp, "<malloc_alignment bytes=\"%ld\" />\n", (long) MALLOC_ALIGNMENT);
+  fprintf (fp, "<min_chunk_size bytes=\"%ld\" />\n", (long) MIN_CHUNK_SIZE);
+  fprintf (fp, "<max_fast_alloc bytes=\"%ld\" />\n", (long) MAX_FAST_SIZE);
+#ifdef MAX_TCACHE_SIZE
+  fprintf (fp, "<max_tcache_alloc bytes=\"%ld\" />\n", (long) MAX_TCACHE_SIZE);
+#endif
+  fprintf (fp, "<min_large_alloc bytes=\"%ld\" />\n", (long) MIN_LARGE_SIZE);
+  fprintf (fp, "<default_mmap_threshold bytes=\"%ld\" />\n", (long) DEFAULT_MMAP_THRESHOLD);
+  fprintf (fp, "<max_mmap_threshold bytes=\"%ld\" />\n", (long) DEFAULT_MMAP_THRESHOLD_MAX);
+  fprintf (fp, "<heap_min_size bytes=\"%ld\" />\n", (long) HEAP_MIN_SIZE);
+  fprintf (fp, "<heap_max_size bytes=\"%ld\" />\n", (long) HEAP_MAX_SIZE);
+
   /* Iterate over all arenas currently in use.  */
   mstate ar_ptr = &main_arena;
   do