Skip to content

Commit 459a492

Browse files
committed
Fix return values from jemalloc hooks
For OS provider, merge, split and commits are nops. This means we should return false, not true from those hooks. Ref: https://github.com/memkind/memkind/blob/c425635feb0367c43da8fa0deadb50a4bc127988/src/memkind_arena.c
1 parent 2372e9f commit 459a492

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/pool/pool_jemalloc.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ static bool arena_extent_commit(extent_hooks_t *extent_hooks, void *addr,
136136
(void)length; // unused
137137
(void)arena_ind; // unused
138138

139-
return true; // true means failure (unsupported)
139+
// TODO: add this function to the provider API to support Windows and USM
140+
return false; // false means success (commit is a nop)
140141
}
141142

142143
// arena_extent_decommit - an extent decommit function conforms to the extent_decommit_t type
@@ -156,6 +157,7 @@ static bool arena_extent_decommit(extent_hooks_t *extent_hooks, void *addr,
156157
(void)length; // unused
157158
(void)arena_ind; // unused
158159

160+
// TODO: add this function to the provider API to support Windows and USM
159161
return true; // true means failure (unsupported)
160162
}
161163

@@ -215,7 +217,8 @@ static bool arena_extent_split(extent_hooks_t *extent_hooks, void *addr,
215217
(void)committed; // unused
216218
(void)arena_ind; // unused
217219

218-
return true; // true means failure (unsupported)
220+
// TODO: add this function to the provider API to support Windows and USM
221+
return false; // false means success (split is a nop)
219222
}
220223

221224
// arena_extent_merge - an extent merge function conforms to the extent_merge_t type and optionally
@@ -235,7 +238,8 @@ static bool arena_extent_merge(extent_hooks_t *extent_hooks, void *addr_a,
235238
(void)committed; // unused
236239
(void)arena_ind; // unused
237240

238-
return true; // true means failure (unsupported)
241+
// TODO: add this function to the provider API to support Windows and USM
242+
return false; // false means success (merge is a nop)
239243
}
240244

241245
// The extent_hooks_t structure comprises function pointers which are described individually below.

0 commit comments

Comments
 (0)