1 /* |
1 /* |
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
3 * |
3 * |
4 * Copyright 2013 Olaf Wintermann. All rights reserved. |
4 * Copyright 2015 Olaf Wintermann. All rights reserved. |
5 * |
5 * |
6 * Redistribution and use in source and binary forms, with or without |
6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions are met: |
7 * modification, are permitted provided that the following conditions are met: |
8 * |
8 * |
9 * 1. Redistributions of source code must retain the above copyright |
9 * 1. Redistributions of source code must retain the above copyright |
119 */ |
112 */ |
120 void *ucx_mempool_malloc(UcxMempool *pool, size_t n); |
113 void *ucx_mempool_malloc(UcxMempool *pool, size_t n); |
121 /** |
114 /** |
122 * Allocates a pooled memory array. |
115 * Allocates a pooled memory array. |
123 * |
116 * |
124 * The contents of the allocated memory is set to zero. |
117 * The content of the allocated memory is set to zero. |
125 * |
118 * |
126 * @param pool the memory pool |
119 * @param pool the memory pool |
127 * @param nelem amount of elements to allocate |
120 * @param nelem amount of elements to allocate |
128 * @param elsize amount of memory per element |
121 * @param elsize amount of memory per element |
129 * @return a pointer to the allocated memory |
122 * @return a pointer to the allocated memory |
140 * and exit the program with error code <code>EXIT_FAILURE</code>. |
133 * and exit the program with error code <code>EXIT_FAILURE</code>. |
141 * |
134 * |
142 * @param pool the memory pool |
135 * @param pool the memory pool |
143 * @param ptr a pointer to the memory that shall be reallocated |
136 * @param ptr a pointer to the memory that shall be reallocated |
144 * @param n the new size of the memory |
137 * @param n the new size of the memory |
145 * @return a pointer to the the location of the memory |
138 * @return a pointer to the new location of the memory |
146 * @see ucx_allocator_realloc() |
139 * @see ucx_allocator_realloc() |
147 */ |
140 */ |
148 void *ucx_mempool_realloc(UcxMempool *pool, void *ptr, size_t n); |
141 void *ucx_mempool_realloc(UcxMempool *pool, void *ptr, size_t n); |
149 |
142 |
150 /** |
143 /** |