MCPcopy Create free account
hub / github.com/F-Stack/f-stack / memstat_malloc_zone_init

Function memstat_malloc_zone_init

tools/libmemstat/memstat_malloc.c:453–475  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

451}
452
453static int
454memstat_malloc_zone_init(void)
455{
456 size_t size;
457
458 size = sizeof(memstat_malloc_zone_count);
459 if (sysctlbyname("vm.malloc.zone_count", &memstat_malloc_zone_count,
460 &size, NULL, 0) < 0) {
461 return (-1);
462 }
463
464 if (memstat_malloc_zone_count > (int)nitems(memstat_malloc_zone_sizes)) {
465 return (-1);
466 }
467
468 size = sizeof(memstat_malloc_zone_sizes);
469 if (sysctlbyname("vm.malloc.zone_sizes", &memstat_malloc_zone_sizes,
470 &size, NULL, 0) < 0) {
471 return (-1);
472 }
473
474 return (0);
475}
476
477/*
478 * Copied from kern_malloc.c

Callers 1

memstat_sysctl_mallocFunction · 0.85

Calls 1

sysctlbynameFunction · 0.85

Tested by

no test coverage detected