#include "internal.h"
Go to the source code of this file.
Functions | |
struct MemoryPool * | MHD_pool_create (unsigned int max) |
void | MHD_pool_destroy (struct MemoryPool *pool) |
void * | MHD_pool_allocate (struct MemoryPool *pool, unsigned int size, int from_end) |
void * | MHD_pool_reallocate (struct MemoryPool *pool, void *old, unsigned int old_size, unsigned int new_size) |
void * | MHD_pool_reset (struct MemoryPool *pool, void *keep, unsigned int size) |
Definition in file memorypool.h.
void* MHD_pool_allocate | ( | struct MemoryPool * | pool, | |
unsigned int | size, | |||
int | from_end | |||
) |
Allocate size bytes from the pool.
from_end | allocate from end of pool (set to MHD_YES); use this for small, persistent allocations that will never be reallocated |
Definition at line 118 of file memorypool.c.
References MHD_YES.
Referenced by build_header_response(), connection_add_header(), parse_cookie_header(), and try_ready_chunked_body().
struct MemoryPool* MHD_pool_create | ( | unsigned int | max | ) | [read] |
Create a memory pool.
max | maximum size of the pool |
Definition at line 68 of file memorypool.c.
References MHD_NO, MHD_YES, and MMAP.
Referenced by MHD_connection_get_fdset().
void MHD_pool_destroy | ( | struct MemoryPool * | pool | ) |
Destroy a memory pool.
Definition at line 101 of file memorypool.c.
References MHD_NO, and MUNMAP.
Referenced by MHD_cleanup_connections(), and MHD_connection_handle_idle().
void* MHD_pool_reallocate | ( | struct MemoryPool * | pool, | |
void * | old, | |||
unsigned int | old_size, | |||
unsigned int | new_size | |||
) |
Reallocate a block of memory obtained from the pool. This is particularly efficient when growing or shrinking the block that was last (re)allocated. If the given block is not the most recenlty (re)allocated block, the memory of the previous allocation may be leaked until the pool is destroyed (and copying the data maybe required).
old | the existing block | |
old_size | the size of the existing block | |
new_size | the new size of the block |
Definition at line 154 of file memorypool.c.
Referenced by check_write_done(), get_next_header_line(), MHD_connection_handle_read(), process_broken_line(), and try_grow_read_buffer().
void* MHD_pool_reset | ( | struct MemoryPool * | pool, | |
void * | keep, | |||
unsigned int | size | |||
) |
Clear all entries from the memory pool except for "keep" of the given "size".
keep | pointer to the entry to keep (maybe NULL) | |
size | how many bytes need to be kept at this address |
Definition at line 200 of file memorypool.c.
Referenced by MHD_connection_handle_idle().