HPCToolkit
|
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <stdint.h>
#include <string.h>
#include <ucontext.h>
#include <stdlib.h>
#include <malloc.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sample-sources/memleak.h>
#include <messages/messages.h>
#include <safe-sampling.h>
#include <sample_event.h>
#include <monitor-exts/monitor_ext.h>
#include <lib/prof-lean/spinlock.h>
#include <lib/prof-lean/splay-macros.h>
#include <utilities/arch/inline-asm-gctxt.h>
#include <utilities/arch/mcontext.h>
Go to the source code of this file.
Classes | |
struct | leakinfo_s |
Macros | |
#define | __USE_XOPEN_EXTENDED |
#define | _XOPEN_SOURCE 600 |
#define | MEMLEAK_USE_HYBRID_LAYOUT 1 |
#define | MEMLEAK_MAGIC 0x68706374 |
#define | MEMLEAK_DEFAULT_PAGESIZE 4096 |
#define | HPCRUN_MEMLEAK_PROB "HPCRUN_MEMLEAK_PROB" |
#define | DEFAULT_PROB 0.1 |
#define | real_memalign __libc_memalign |
#define | real_valloc __libc_valloc |
#define | real_malloc __libc_malloc |
#define | real_free __libc_free |
#define | real_realloc __libc_realloc |
Typedefs | |
typedef struct leakinfo_s | leakinfo_t |
typedef void * | memalign_fcn(size_t, size_t) |
typedef void * | valloc_fcn(size_t) |
typedef void * | malloc_fcn(size_t) |
typedef void | free_fcn(void *) |
typedef void * | realloc_fcn(void *, size_t) |
Enumerations | |
enum | { MEMLEAK_LOC_HEAD = 1, MEMLEAK_LOC_FOOT, MEMLEAK_LOC_NONE } |
Functions | |
static struct leakinfo_s * | splay (struct leakinfo_s *root, void *key) |
static void | splay_insert (struct leakinfo_s *node) |
static struct leakinfo_s * | splay_delete (void *memblock) |
static float | string_to_prob (char *str) |
static void | memleak_initialize (void) |
static int | memleak_same_page (void *p1, void *p2) |
static int | memleak_get_malloc_loc (void *sys_ptr, size_t bytes, size_t align, void **appl_ptr, leakinfo_t **info_ptr) |
static int | memleak_get_free_loc (void *appl_ptr, void **sys_ptr, leakinfo_t **info_ptr) |
static void | memleak_add_leakinfo (const char *name, void *sys_ptr, void *appl_ptr, leakinfo_t *info_ptr, size_t bytes, ucontext_t *uc, int loc) |
static void * | memleak_malloc_helper (const char *name, size_t bytes, size_t align, int clear, ucontext_t *uc, int *ret) |
static void | memleak_free_helper (const char *name, void *sys_ptr, void *appl_ptr, leakinfo_t *info_ptr, int loc) |
int MONITOR_EXT_WRAP_NAME() | posix_memalign (void **memptr, size_t alignment, size_t bytes) |
void *MONITOR_EXT_WRAP_NAME() | memalign (size_t boundary, size_t bytes) |
void *MONITOR_EXT_WRAP_NAME() | valloc (size_t bytes) |
void *MONITOR_EXT_WRAP_NAME() | malloc (size_t bytes) |
void *MONITOR_EXT_WRAP_NAME() | calloc (size_t nmemb, size_t bytes) |
void MONITOR_EXT_WRAP_NAME() | free (void *ptr) |
void *MONITOR_EXT_WRAP_NAME() | realloc (void *ptr, size_t bytes) |
Variables | |
leakinfo_t | leakinfo_NULL = { .magic = 0, .context = NULL, .bytes = 0 } |
memalign_fcn | real_memalign |
valloc_fcn | real_valloc |
malloc_fcn | real_malloc |
free_fcn | real_free |
realloc_fcn | real_realloc |
static int | leak_detection_enabled = 0 |
static int | leak_detection_init = 0 |
static int | use_memleak_prob = 0 |
static float | memleak_prob = 0.0 |
static struct leakinfo_s * | memleak_tree_root = NULL |
static spinlock_t | memtree_lock = SPINLOCK_UNLOCKED |
static int | leakinfo_size = sizeof(struct leakinfo_s) |
static long | memleak_pagesize = MEMLEAK_DEFAULT_PAGESIZE |
static char * | loc_name [4] |
#define __USE_XOPEN_EXTENDED |
Definition at line 60 of file memleak-overrides.c.
#define _XOPEN_SOURCE 600 |
Definition at line 73 of file memleak-overrides.c.
#define DEFAULT_PROB 0.1 |
Definition at line 144 of file memleak-overrides.c.
#define HPCRUN_MEMLEAK_PROB "HPCRUN_MEMLEAK_PROB" |
Definition at line 143 of file memleak-overrides.c.
#define MEMLEAK_DEFAULT_PAGESIZE 4096 |
Definition at line 141 of file memleak-overrides.c.
#define MEMLEAK_MAGIC 0x68706374 |
Definition at line 140 of file memleak-overrides.c.
#define MEMLEAK_USE_HYBRID_LAYOUT 1 |
Definition at line 138 of file memleak-overrides.c.
#define real_free __libc_free |
Definition at line 156 of file memleak-overrides.c.
#define real_malloc __libc_malloc |
Definition at line 155 of file memleak-overrides.c.
#define real_memalign __libc_memalign |
Definition at line 153 of file memleak-overrides.c.
#define real_realloc __libc_realloc |
Definition at line 157 of file memleak-overrides.c.
#define real_valloc __libc_valloc |
Definition at line 154 of file memleak-overrides.c.
typedef void free_fcn(void *) |
Definition at line 129 of file memleak-overrides.c.
typedef struct leakinfo_s leakinfo_t |
typedef void* malloc_fcn(size_t) |
Definition at line 128 of file memleak-overrides.c.
typedef void* memalign_fcn(size_t, size_t) |
Definition at line 126 of file memleak-overrides.c.
typedef void* realloc_fcn(void *, size_t) |
Definition at line 130 of file memleak-overrides.c.
typedef void* valloc_fcn(size_t) |
Definition at line 127 of file memleak-overrides.c.
anonymous enum |
Enumerator | |
---|---|
MEMLEAK_LOC_HEAD | |
MEMLEAK_LOC_FOOT | |
MEMLEAK_LOC_NONE |
Definition at line 183 of file memleak-overrides.c.
void* MONITOR_EXT_WRAP_NAME() calloc | ( | size_t | nmemb, |
size_t | bytes | ||
) |
void MONITOR_EXT_WRAP_NAME() free | ( | void * | ptr | ) |
void* MONITOR_EXT_WRAP_NAME() malloc | ( | size_t | bytes | ) |
void* MONITOR_EXT_WRAP_NAME() memalign | ( | size_t | boundary, |
size_t | bytes | ||
) |
|
static |
Definition at line 442 of file memleak-overrides.c.
|
static |
Definition at line 555 of file memleak-overrides.c.
|
static |
Definition at line 398 of file memleak-overrides.c.
|
static |
Definition at line 372 of file memleak-overrides.c.
|
static |
Definition at line 303 of file memleak-overrides.c.
|
static |
Definition at line 489 of file memleak-overrides.c.
|
inlinestatic |
int MONITOR_EXT_WRAP_NAME() posix_memalign | ( | void ** | memptr, |
size_t | alignment, | ||
size_t | bytes | ||
) |
void* MONITOR_EXT_WRAP_NAME() realloc | ( | void * | ptr, |
size_t | bytes | ||
) |
|
static |
|
static |
Definition at line 239 of file memleak-overrides.c.
|
static |
Definition at line 209 of file memleak-overrides.c.
|
static |
void* MONITOR_EXT_WRAP_NAME() valloc | ( | size_t | bytes | ) |
|
static |
Definition at line 172 of file memleak-overrides.c.
|
static |
Definition at line 173 of file memleak-overrides.c.
leakinfo_t leakinfo_NULL = { .magic = 0, .context = NULL, .bytes = 0 } |
Definition at line 124 of file memleak-overrides.c.
|
static |
Definition at line 180 of file memleak-overrides.c.
|
static |
Definition at line 189 of file memleak-overrides.c.
|
static |
Definition at line 181 of file memleak-overrides.c.
|
static |
Definition at line 175 of file memleak-overrides.c.
|
static |
Definition at line 177 of file memleak-overrides.c.
|
static |
Definition at line 178 of file memleak-overrides.c.
free_fcn real_free |
malloc_fcn real_malloc |
memalign_fcn real_memalign |
realloc_fcn real_realloc |
valloc_fcn real_valloc |
|
static |
Definition at line 174 of file memleak-overrides.c.