aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar David Garcia Quintas <dgq@google.com>2015-12-09 14:17:52 -0800
committerGravatar David Garcia Quintas <dgq@google.com>2015-12-09 14:17:52 -0800
commita5aa19b8b6c8ce2c2ce9baa8b0108e91b9c330b1 (patch)
tree1e2db2da10c60db11ae833d72f2fa0e2b7658e88 /include
parentf80b536a5a806e7a9cfdac87eacf52c24aa0b723 (diff)
PR comments
Diffstat (limited to 'include')
-rw-r--r--include/grpc/support/alloc.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/grpc/support/alloc.h b/include/grpc/support/alloc.h
index 9d4e743da7..ae725700dc 100644
--- a/include/grpc/support/alloc.h
+++ b/include/grpc/support/alloc.h
@@ -40,6 +40,12 @@
extern "C" {
#endif
+typedef struct gpr_allocation_functions {
+ void *(*malloc_fn)(size_t size);
+ void *(*realloc_fn)(void *ptr, size_t size);
+ void (*free_fn)(void *ptr);
+} gpr_allocation_functions;
+
/* malloc, never returns NULL */
void *gpr_malloc(size_t size);
/* free */
@@ -51,6 +57,14 @@ void *gpr_malloc_aligned(size_t size, size_t alignment_log);
/* free memory allocated by gpr_malloc_aligned */
void gpr_free_aligned(void *ptr);
+/** Request the family of allocation functions in \a functions be used. NOTE
+ * that this request will be honored in a *best effort* basis and that no
+ * guarantees are made about the default functions (eg, malloc) being called. */
+void gpr_set_allocation_functions(gpr_allocation_functions functions);
+
+/** Return the family of allocation functions currently in effect. */
+gpr_allocation_functions gpr_get_allocation_functions();
+
#ifdef __cplusplus
}
#endif