Grok  7.6.3
MemManager.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016-2021 Grok Image Compression Inc.
3  *
4  * This source code is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Affero General Public License, version 3,
6  * as published by the Free Software Foundation.
7  *
8  * This source code is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU Affero General Public License for more details.
12  *
13  * You should have received a copy of the GNU Affero General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  *
17  * This source code incorporates work covered by the BSD 2-clause license.
18  * Please see the LICENSE file in the root directory for details.
19  *
20  */
21 
22 #pragma once
23 
24 #include <stddef.h>
25 
26 namespace grk {
27 
28 const size_t default_align = 64;
29 
30 uint32_t grk_make_aligned_width(uint32_t width);
31 
37 void* grk_malloc(size_t size);
38 
45 void* grk_calloc(size_t numOfElements, size_t sizeOfElements);
46 
52 void* grk_aligned_malloc(size_t size);
53 void grk_aligned_free(void *ptr);
54 
61 void* grk_realloc(void *m, size_t s);
62 
67 void grk_free(void *m);
68 
69 #if defined(__GNUC__) && !defined(GROK_SKIP_POISON)
70 #pragma GCC poison malloc calloc realloc free
71 #endif
72 
73 /* ----------------------------------------------------------------------- */
77 
78 }
grk::grk_aligned_free
void grk_aligned_free(void *ptr)
Definition: MemManager.cpp:123
grk::grk_calloc
void * grk_calloc(size_t num, size_t size)
Allocate a memory block with elements initialized to 0.
Definition: MemManager.cpp:111
grk::grk_free
void grk_free(void *ptr)
Deallocates or frees a memory block.
Definition: MemManager.cpp:141
grk::grk_make_aligned_width
uint32_t grk_make_aligned_width(uint32_t width)
Definition: MemManager.cpp:40
grk::grk_aligned_malloc
void * grk_aligned_malloc(size_t size)
Allocate memory aligned to a 16 byte boundary.
Definition: MemManager.cpp:119
grk
Copyright (C) 2016-2021 Grok Image Compression Inc.
Definition: BitIO.cpp:23
grk::grk_malloc
void * grk_malloc(size_t size)
Allocate an uninitialized memory block.
Definition: MemManager.cpp:105
grk_includes.h
grk::grk_alignment
const uint32_t grk_alignment
Definition: MemManager.cpp:38
grk::grk_realloc
void * grk_realloc(void *ptr, size_t new_size)
Reallocate memory blocks.
Definition: MemManager.cpp:135
grk::grk_aligned_alloc_n
static void * grk_aligned_alloc_n(size_t alignment, size_t size)
Definition: MemManager.cpp:45
grk::default_align
const size_t default_align
Definition: MemManager.h:28
SIZE_MAX
#define SIZE_MAX
Definition: MemManager.cpp:33