aboutsummaryrefslogtreecommitdiffstats
path: root/inc/malloc.h
blob: 75ea6e987cb0c20ef6b27c06b9585465771992d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/**
 * @file   malloc.h
 * @brief  Public interface for the ft_malloc allocator.
 *
 * Declares malloc, free, realloc, and show_alloc_mem with the same
 * prototypes as their libc counterparts so the library can be used
 * as a drop-in replacement via LD_PRELOAD.
 */

#ifndef MALLOC_H
#define MALLOC_H

#include <stddef.h>

/** @brief Release the memory block at @p ptr. */
void free (void *ptr);

/** @brief Allocate @p size bytes and return a pointer to them. */
void *malloc (size_t size);

/**
 * @brief  Resize the block at @p ptr to @p size bytes.
 * @return Pointer to the (possibly moved) block, or NULL on failure.
 */
void *realloc (void *ptr, size_t size);

/**
 * @brief  Print every allocated zone and block to stdout, sorted by
 *         ascending address.
 */
void show_alloc_mem (void);

#endif