diff options
author | Lukas Larsson <[email protected]> | 2011-09-29 18:02:47 +0200 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2011-09-29 18:02:47 +0200 |
commit | 09c46998b3a4b0060b3ff3799c142d564f91f517 (patch) | |
tree | 8f2f5f53b4efc4a0b19c3b668485f679a09f7e65 /erts/emulator/beam/erl_alloc.c | |
parent | 71099221fc8d0456fb38b1954e9053ec527d43b2 (diff) | |
parent | beaa58d5724c4ae45a716accdeee58961a27e1d9 (diff) | |
download | otp-09c46998b3a4b0060b3ff3799c142d564f91f517.tar.gz otp-09c46998b3a4b0060b3ff3799c142d564f91f517.tar.bz2 otp-09c46998b3a4b0060b3ff3799c142d564f91f517.zip |
Merge branch 'dev' into major
* dev:
Prevent valgrind warning for erts_alloc_permanent_cache_aligned
[erts] Fix memory leak in erts_make_stub_module (hipe loading)
Diffstat (limited to 'erts/emulator/beam/erl_alloc.c')
-rw-r--r-- | erts/emulator/beam/erl_alloc.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/erts/emulator/beam/erl_alloc.c b/erts/emulator/beam/erl_alloc.c index bbc8a445a7..9af80dd7a9 100644 --- a/erts/emulator/beam/erl_alloc.c +++ b/erts/emulator/beam/erl_alloc.c @@ -2960,6 +2960,29 @@ erts_allocator_options(void *proc) return res; } +void *erts_alloc_permanent_cache_aligned(ErtsAlcType_t type, Uint size) +{ + UWord v = (UWord) erts_alloc(type, size + (ERTS_CACHE_LINE_SIZE-1)); + +#ifdef VALGRIND + { /* Avoid Leak_PossiblyLost */ + static UWord vg_root_set[10]; + static unsigned ix = 0; + if (ix >= sizeof(vg_root_set) / sizeof(*vg_root_set)) { + erl_exit(ERTS_ABORT_EXIT, "Too many erts_alloc_permanent_cache_aligned's\n"); + } + vg_root_set[ix++] = v; /* not thread safe */ + } +#endif + + if (v & ERTS_CACHE_LINE_MASK) { + v = (v & ~ERTS_CACHE_LINE_MASK) + ERTS_CACHE_LINE_SIZE; + } + ASSERT((v & ERTS_CACHE_LINE_MASK) == 0); + return (void*)v; +} + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\ * Deprecated functions * * * @@ -3583,6 +3606,4 @@ install_debug_functions(void) return FENCE_SZ; } - - #endif /* #ifdef DEBUG */ |