1MEMKIND_ARENA(3) MEMKIND_ARENA MEMKIND_ARENA(3)
2
3
4
6 memkind_arena.h - jemalloc arena allocation memkind operations.
7 Note: This is EXEPRIMENTAL API. The functionality and the header file
8 itself can be changed (including non-backward compatible changes), or
9 remove.
10
12 #include <memkind/internal/memkind_arena.h>
13
14 Link with -lmemkind
15
16 int memkind_arena_create(struct memkind *kind, struct memkind_ops *ops, const char *name);
17 int memkind_arena_create_map(struct memkind *kind);
18 int memkind_arena_destroy(struct memkind *kind);
19 void *memkind_arena_malloc(struct memkind *kind, size_t size);
20 void *memkind_arena_calloc(struct memkind *kind, size_t num, size_t size);
21 int memkind_arena_posix_memalign(struct memkind *kind, void **memptr, size_t alignment, size_t size);
22 void *memkind_arena_realloc(struct memkind *kind, void *ptr, size_t size);
23 int memkind_thread_get_arena(struct memkind *kind, unsigned int *arena,size_t size");
24 int memkind_bijective_get_arena(struct memkind *kind, unsigned int *arena,size_t size");
25
27 This header file is a collection of functions can be used to populate
28 the memkind operations structure for memory kinds that use jemalloc.
29
30 memkind_arena_create() is an implementation of the memkind "create"
31 operation for memory kinds that use jemalloc. This calls
32 memkind_default_create() (see memkind_default.h(3)) followed by
33 memkind_arena_create_map() described below.
34
35 memkind_arena_create_map() creates the arena_map array for the memkind
36 structure pointed to by kind which can be indexed by the
37 ops.get_arena() function from the kind's operations. If get_arena
38 points memkind_thread_get_arena() then there will be four arenas cre‐
39 ated for each processor, and if get_arena points to memkind_bijec‐
40 tive_get_arena() then just one arena is created.
41
42 memkind_arena_destroy() is an implementation of the memkind "destroy"
43 operation for memory kinds that use jemalloc. This releases all of the
44 resources allocated by memkind_arena_create().
45
46 memkind_arena_malloc() is an implementation of the memkind "malloc"
47 operation for memory kinds that use jemalloc. This allocates memory
48 using the arenas created by memkind_arena_create() through the jemal‐
49 loc's mallocx() interface. It uses the memkind "get_arena" operation
50 to select the arena.
51
52 memkind_arena_calloc() is an implementation of the memkind "calloc"
53 operation for memory kinds that use jemalloc. This allocates memory
54 using the arenas created by memkind_arena_create() through the jemal‐
55 loc's mallocx() interface. It uses the memkind "get_arena" operation
56 to select the arena.
57
58 memkind_arena_posix_memalign() is an implementation of the memkind
59 "posix_memalign" operation for memory kinds that use jemalloc. This
60 allocates memory using the arenas created by memkind_arena_create()
61 through the jemalloc's mallocx() interface. It uses the memkind
62 "get_arena" operation to select the arena. The POSIX standard requires
63 that posix_memalign(3) may not set errno however the jemalloc's mal‐
64 locx() routine may. In an attempt to abide by the standard errno is
65 recorded before calling jemalloc's mallocx() and then reset after the
66 call.
67
68 memkind_arena_realloc() is an implementation of the memkind "realloc"
69 operation for memory kinds that use jemalloc. This allocates memory
70 using the arenas created by memkind_arena_create() through the jemal‐
71 loc's mallocx() interface. It uses the memkind "get_arena" operation
72 to select the arena.
73
74 memkind_thread_get_arena() Retrieves the arena index that is bound to
75 to the calling thread based on a hash of its thread ID. The arena
76 index can be used with the MALLOCX_ARENA macro to set flags for jemal‐
77 loc's mallocx().
78
79 memkind_bijective_arena_get_arena() Retrieves the arena index to be
80 used with the MALLOCX_ARENA macro to set flags for jemalloc's mal‐
81 locx(). Use of this operation implies that only one arena is used for
82 the kind.
83
85 Copyright (C) 2014 - 2016 Intel Corporation. All rights reserved.
86
88 memkind(3), memkind_default(3), memkind_hbw(3), memkind_hugetlb(3),
89 memkind_pmem(3), jemalloc(3), mbind(2), mmap(2)
90
91
92
93Intel Corporation 2015-04-21 MEMKIND_ARENA(3)