File: ex_stats_print.c

package info (click to toggle)
jemalloc 5.3.0-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 5,648 kB
  • sloc: ansic: 62,360; perl: 4,214; sh: 3,716; makefile: 700; cpp: 374; python: 335; csh: 7
file content (25 lines) | stat: -rw-r--r-- 331 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <stdlib.h>
#include <jemalloc/jemalloc.h>

void
do_something(size_t i)
{

  // Leak some memory.
  malloc(i * 100);
}

int
main(int argc, char **argv)
{
  size_t i;

  for (i = 0; i < 1000; i++) {
    do_something(i);
  }

  // Dump allocator statistics to stderr.
  malloc_stats_print(NULL, NULL, NULL);

  return (0);
}