Scippy

SCIP

Solving Constraint Integer Programs

memory.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the library */
4 /* BMS --- Block Memory Shell */
5 /* */
6 /* Copyright (C) 2002-2017 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* BMS is distributed under the terms of the ZIB Academic License. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with BMS; see the file COPYING. If not email to scip@zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file memory.h
17  * @brief memory allocation routines
18  * @author Tobias Achterberg
19  * @author Gerald Gamrath
20  * @author Marc Pfetsch
21  */
22 
23 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
24 
25 #ifndef __BMS_MEMORY_H__
26 #define __BMS_MEMORY_H__
27 
28 #include <limits.h>
29 #include <stdlib.h>
30 #include <stddef.h>
31 
32 /* special thanks to Daniel Junglas for following template and macros */
33 #ifdef __cplusplus
34 
35 template<typename T> T* docast(T*, void *v) { return reinterpret_cast<T*>(v); }
36 
37 extern "C" {
38 
39 #define ASSIGN(pointerstarstar, voidstarfunction) (*(pointerstarstar) = docast(*(pointerstarstar), (voidstarfunction)))
40 
41 #else
42 
43 #define ASSIGN(pointerstarstar, voidstarfunction) (*(pointerstarstar) = (voidstarfunction))
44 
45 #endif
46 
47 /*
48  * Define the macro EXTERN depending if the OS is Windows or not
49  */
50 #ifndef EXTERN
51 
52 #if defined(_WIN32) || defined(_WIN64)
53 #define EXTERN __declspec(dllexport)
54 #else
55 #define EXTERN extern
56 #endif
57 
58 #endif
59 
60 
61 
62 /*************************************************************************************
63  * Standard Memory Management
64  *
65  * In debug mode, these methods extend malloc() and free() by logging all currently
66  * allocated memory elements in an allocation list. This can be used as a simple leak
67  * detection.
68  *************************************************************************************/
69 
70 /* Note: values that are passed as a size_t parameter are first converted to ptrdiff_t to be sure that negative numbers
71  * are extended to the larger size. Then they are converted to size_t. Thus, negative numbers are converted to very
72  * large size_t values. This is then checked within the functions. */
73 
74 #define BMSallocMemory(ptr) ASSIGN((ptr), BMSallocMemory_call( sizeof(**(ptr)), __FILE__, __LINE__ ))
75 #define BMSallocMemorySize(ptr,size) ASSIGN((ptr), BMSallocMemory_call( (size_t)(ptrdiff_t)(size), __FILE__, __LINE__ ))
76 #define BMSallocMemoryCPP(size) BMSallocMemory_call( (size_t)(ptrdiff_t)(size), __FILE__, __LINE__ )
77 #define BMSallocClearMemorySize(ptr,size) ASSIGN((ptr), BMSallocClearMemory_call((size_t)(1), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__ ))
78 #define BMSallocMemoryArray(ptr,num) ASSIGN((ptr), BMSallocMemoryArray_call((size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__ ))
79 #define BMSallocMemoryArrayCPP(num,size) BMSallocMemoryArray_call( (size_t)(ptrdiff_t)(num), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__ )
80 #define BMSallocClearMemoryArray(ptr,num) ASSIGN((ptr), BMSallocClearMemory_call((size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__ ))
81 #define BMSreallocMemorySize(ptr,size) ASSIGN((ptr), BMSreallocMemory_call((void*)(*(ptr)), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__ ))
82 #define BMSreallocMemoryArray(ptr,num) ASSIGN((ptr), BMSreallocMemoryArray_call( *(ptr), (size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__ ))
83 
84 #define BMSclearMemory(ptr) BMSclearMemory_call( (void*)(ptr), sizeof(*(ptr)) )
85 #define BMSclearMemoryArray(ptr, num) BMSclearMemory_call( (void*)(ptr), (size_t)(ptrdiff_t)(num)*sizeof(*(ptr)) )
86 #define BMSclearMemorySize(ptr, size) BMSclearMemory_call( (void*)(ptr), (size_t)(ptrdiff_t)(size) )
87 
88 #define BMScopyMemory(ptr, source) BMScopyMemory_call( (void*)(ptr), (const void*)(source), sizeof(*(ptr)) )
89 #define BMScopyMemoryArray(ptr, source, num) BMScopyMemory_call( (void*)(ptr), (const void*)(source), (size_t)(ptrdiff_t)(num)*sizeof(*(ptr)) )
90 #define BMScopyMemorySize(ptr, source, size) BMScopyMemory_call( (void*)(ptr), (const void*)(source), (size_t)(ptrdiff_t)(size) )
91 
92 #define BMSmoveMemory(ptr, source) BMSmoveMemory_call( (void*)(ptr), (const void*)(source), sizeof(*(ptr)) )
93 #define BMSmoveMemoryArray(ptr, source, num) BMSmoveMemory_call( (void*)(ptr), (const void*)(source), (size_t)(ptrdiff_t)(num) * sizeof(*(ptr)) )
94 #define BMSmoveMemorySize(ptr, source, size) BMSmoveMemory_call( (void*)(ptr), (const void*)(source), (size_t)(ptrdiff_t)(size) )
95 
96 #define BMSduplicateMemory(ptr, source) ASSIGN((ptr), BMSduplicateMemory_call( (const void*)(source), sizeof(**(ptr)), __FILE__, __LINE__ ))
97 #define BMSduplicateMemorySize(ptr, source, size) ASSIGN((ptr), BMSduplicateMemory_call( (const void*)(source), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__ ))
98 #define BMSduplicateMemoryArray(ptr, source, num) ASSIGN((ptr), BMSduplicateMemoryArray_call( (const void*)(source), (size_t)(ptrdiff_t)(num), \
99  sizeof(**(ptr)), __FILE__, __LINE__ ))
100 #define BMSfreeMemory(ptr) BMSfreeMemory_call( (void**)(ptr), __FILE__, __LINE__ )
101 #define BMSfreeMemoryNull(ptr) BMSfreeMemoryNull_call( (void**)(ptr), __FILE__, __LINE__ )
102 #define BMSfreeMemoryArray(ptr) BMSfreeMemory_call( (void**)(ptr), __FILE__, __LINE__ )
103 #define BMSfreeMemoryArrayNull(ptr) BMSfreeMemoryNull_call( (void**)(ptr), __FILE__, __LINE__ )
104 #define BMSfreeMemorySize(ptr) BMSfreeMemory_call( (void**)(ptr), __FILE__, __LINE__ )
105 #define BMSfreeMemorySizeNull(ptr) BMSfreeMemoryNull_call( (void**)(ptr), __FILE__, __LINE__ )
106 
107 #ifndef NDEBUG
108 #define BMSgetPointerSize(ptr) BMSgetPointerSize_call(ptr)
109 #define BMSdisplayMemory() BMSdisplayMemory_call()
110 #define BMScheckEmptyMemory() BMScheckEmptyMemory_call()
111 #define BMSgetMemoryUsed() BMSgetMemoryUsed_call()
112 #else
113 #define BMSgetPointerSize(ptr) 0
114 #define BMSdisplayMemory() /**/
115 #define BMScheckEmptyMemory() /**/
116 #define BMSgetMemoryUsed() 0LL
117 #endif
118 
119 /** allocates array and initializes it with 0; returns NULL if memory allocation failed */
120 extern
122  size_t num, /**< number of memory element to allocate */
123  size_t typesize, /**< size of memory element to allocate */
124  const char* filename, /**< source file where the allocation is performed */
125  int line /**< line number in source file where the allocation is performed */
126  );
127 
128 /** allocates memory; returns NULL if memory allocation failed */
129 extern
130 void* BMSallocMemory_call(
131  size_t size, /**< size of memory element to allocate */
132  const char* filename, /**< source file where the allocation is performed */
133  int line /**< line number in source file where the allocation is performed */
134  );
135 
136 /** allocates array; returns NULL if memory allocation failed */
137 extern
139  size_t num, /**< number of components of array to allocate */
140  size_t typesize, /**< size of each component */
141  const char* filename, /**< source file where the allocation is performed */
142  int line /**< line number in source file where the allocation is performed */
143  );
144 
145 /** allocates memory; returns NULL if memory allocation failed */
146 extern
148  void* ptr, /**< pointer to memory to reallocate */
149  size_t size, /**< new size of memory element */
150  const char* filename, /**< source file where the reallocation is performed */
151  int line /**< line number in source file where the reallocation is performed */
152  );
153 
154 /** reallocates array; returns NULL if memory allocation failed */
155 extern
157  void* ptr, /**< pointer to memory to reallocate */
158  size_t num, /**< number of components of array to allocate */
159  size_t typesize, /**< size of each component */
160  const char* filename, /**< source file where the reallocation is performed */
161  int line /**< line number in source file where the reallocation is performed */
162  );
163 
164 /** clears a memory element (i.e. fills it with zeros) */
165 extern
167  void* ptr, /**< pointer to memory element */
168  size_t size /**< size of memory element */
169  );
170 
171 /** copies the contents of one memory element into another memory element */
172 extern
173 void BMScopyMemory_call(
174  void* ptr, /**< pointer to target memory element */
175  const void* source, /**< pointer to source memory element */
176  size_t size /**< size of memory element to copy */
177  );
178 
179 /** moves the contents of one memory element into another memory element, should be used if both elements overlap,
180  * otherwise BMScopyMemory is faster
181  */
182 extern
183 void BMSmoveMemory_call(
184  void* ptr, /**< pointer to target memory element */
185  const void* source, /**< pointer to source memory element */
186  size_t size /**< size of memory element to copy */
187  );
188 
189 /** allocates memory and copies the contents of the given memory element into the new memory element */
190 extern
192  const void* source, /**< pointer to source memory element */
193  size_t size, /**< size of memory element to copy */
194  const char* filename, /**< source file where the duplication is performed */
195  int line /**< line number in source file where the duplication is performed */
196  );
197 
198 /** allocates array and copies the contents of the given source array into the new array */
199 extern
201  const void* source, /**< pointer to source memory element */
202  size_t num, /**< number of components of array to allocate */
203  size_t typesize, /**< size of each component */
204  const char* filename, /**< source file where the duplication is performed */
205  int line /**< line number in source file where the duplication is performed */
206  );
207 
208 /** frees an allocated memory element and sets pointer to NULL */
209 extern
210 void BMSfreeMemory_call(
211  void** ptr, /**< pointer to pointer to memory element */
212  const char* filename, /**< source file where the deallocation is performed */
213  int line /**< line number in source file where the deallocation is performed */
214  );
215 
216 /** frees an allocated memory element if pointer is not NULL and sets pointer to NULL */
217 extern
219  void** ptr, /**< pointer to pointer to memory element */
220  const char* filename, /**< source file where the deallocation is performed */
221  int line /**< line number in source file where the deallocation is performed */
222  );
223 
224 /** returns the size of an allocated memory element */
225 extern
227  const void* ptr /**< pointer to allocated memory */
228  );
229 
230 /** outputs information about currently allocated memory to the screen */
231 extern
233  void
234  );
235 
236 /** displays a warning message on the screen, if allocated memory exists */
237 extern
239  void
240  );
241 
242 /** returns total number of allocated bytes */
243 extern
244 long long BMSgetMemoryUsed_call(
245  void
246  );
247 
248 
249 
250 
251 /********************************************************************
252  * Chunk Memory Management
253  *
254  * Efficient memory management for multiple objects of the same size
255  ********************************************************************/
256 
257 typedef struct BMS_ChkMem BMS_CHKMEM; /**< collection of memory chunks of the same element size */
258 
259 
260 #ifndef BMS_NOBLOCKMEM
261 
262 #define BMScreateChunkMemory(sz,isz,gbf) BMScreateChunkMemory_call( (sz), (isz), (gbf), __FILE__, __LINE__ )
263 #define BMSclearChunkMemory(mem) BMSclearChunkMemory_call( (mem), __FILE__, __LINE__ )
264 #define BMSdestroyChunkMemory(mem) BMSdestroyChunkMemory_call( (mem), __FILE__, __LINE__ )
265 
266 #define BMSallocChunkMemory(mem,ptr) ASSIGN((ptr), BMSallocChunkMemory_call((mem), sizeof(**(ptr)), __FILE__, __LINE__))
267 #define BMSduplicateChunkMemory(mem, ptr, source) ASSIGN((ptr), BMSduplicateChunkMemory_call((mem), (const void*)(source), \
268  sizeof(**(ptr)), __FILE__, __LINE__ ))
269 #define BMSfreeChunkMemory(mem,ptr) BMSfreeChunkMemory_call( (mem), (void**)(ptr), sizeof(**(ptr)), __FILE__, __LINE__ )
270 #define BMSfreeChunkMemoryNull(mem,ptr) BMSfreeChunkMemoryNull_call( (mem), (void**)(ptr) )
271 #define BMSgarbagecollectChunkMemory(mem) BMSgarbagecollectChunkMemory_call(mem)
272 #define BMSgetChunkMemoryUsed(mem) BMSgetChunkMemoryUsed_call(mem)
273 
274 #else
275 
276 /* block memory management mapped to standard memory management */
277 
278 #define BMScreateChunkMemory(sz,isz,gbf) (void*)(0x01) /* dummy to not return a NULL pointer */
279 #define BMSclearChunkMemory(mem) /**/
280 #define BMSclearChunkMemoryNull(mem) /**/
281 #define BMSdestroyChunkMemory(mem) /**/
282 #define BMSdestroyChunkMemoryNull(mem) /**/
283 #define BMSallocChunkMemory(mem,ptr) BMSallocMemory(ptr)
284 #define BMSduplicateChunkMemory(mem, ptr, source) BMSduplicateMemory(ptr,source)
285 #define BMSfreeChunkMemory(mem,ptr) BMSfreeMemory(ptr)
286 #define BMSfreeChunkMemoryNull(mem,ptr) BMSfreeMemoryNull(ptr)
287 #define BMSgarbagecollectChunkMemory(mem) /**/
288 #define BMSgetChunkMemoryUsed(mem) 0LL
289 
290 #endif
291 
292 
293 /** aligns the given byte size corresponding to the minimal alignment for chunk and block memory */
294 extern
295 void BMSalignMemsize(
296  size_t* size /**< pointer to the size to align */
297  );
298 
299 /** checks whether the given size meets the alignment conditions for chunk and block memory */
300 extern
301 int BMSisAligned(
302  size_t size /**< size to check for alignment */
303  );
304 
305 /** creates a new chunk block data structure */
306 extern
308  size_t size, /**< element size of the chunk block */
309  int initchunksize, /**< number of elements in the first chunk of the chunk block */
310  int garbagefactor, /**< garbage collector is called, if at least garbagefactor * avg. chunksize
311  * elements are free (-1: disable garbage collection) */
312  const char* filename, /**< source file of the function call */
313  int line /**< line number in source file of the function call */
314  );
315 
316 /** clears a chunk block data structure */
317 extern
319  BMS_CHKMEM* chkmem, /**< chunk block */
320  const char* filename, /**< source file of the function call */
321  int line /**< line number in source file of the function call */
322  );
323 
324 /** destroys and frees a chunk block data structure */
325 extern
327  BMS_CHKMEM** chkmem, /**< pointer to chunk block */
328  const char* filename, /**< source file of the function call */
329  int line /**< line number in source file of the function call */
330  );
331 
332 /** allocates a memory element of the given chunk block */
333 extern
335  BMS_CHKMEM* chkmem, /**< chunk block */
336  size_t size, /**< size of memory element to allocate (only needed for sanity check) */
337  const char* filename, /**< source file of the function call */
338  int line /**< line number in source file of the function call */
339  );
340 
341 /** duplicates a given memory element by allocating a new element of the same chunk block and copying the data */
342 extern
344  BMS_CHKMEM* chkmem, /**< chunk block */
345  const void* source, /**< source memory element */
346  size_t size, /**< size of memory element to allocate (only needed for sanity check) */
347  const char* filename, /**< source file of the function call */
348  int line /**< line number in source file of the function call */
349  );
350 
351 /** frees a memory element of the given chunk block and sets pointer to NULL */
352 extern
354  BMS_CHKMEM* chkmem, /**< chunk block */
355  void** ptr, /**< pointer to pointer to memory element to free */
356  size_t size, /**< size of memory element to allocate (only needed for sanity check) */
357  const char* filename, /**< source file of the function call */
358  int line /**< line number in source file of the function call */
359  );
360 
361 /** frees a memory element of the given chunk block if pointer is not NULL and sets pointer to NULL */
362 extern
364  BMS_CHKMEM* chkmem, /**< chunk block */
365  void** ptr, /**< pointer to pointer to memory element to free */
366  size_t size, /**< size of memory element to allocate (only needed for sanity check) */
367  const char* filename, /**< source file of the function call */
368  int line /**< line number in source file of the function call */
369  );
370 
371 /** calls garbage collection of chunk block and frees chunks without allocated memory elements */
372 extern
374  BMS_CHKMEM* chkmem /**< chunk block */
375  );
376 
377 /** returns the number of allocated bytes in the chunk block */
378 extern
380  const BMS_CHKMEM* chkmem /**< chunk block */
381  );
382 
383 
384 
385 
386 /***********************************************************
387  * Block Memory Management
388  *
389  * Efficient memory management for objects of varying sizes
390  ***********************************************************/
391 
392 typedef struct BMS_BlkMem BMS_BLKMEM; /**< block memory: collection of chunk blocks */
393 
394 #ifndef BMS_NOBLOCKMEM
395 
396 /* block memory methods for faster memory access */
397 
398 /* Note: values that are passed as a size_t parameter are first converted to ptrdiff_t to be sure that negative numbers
399  * are extended to the larger size. Then they are converted to size_t. Thus, negative numbers are converted to very
400  * large size_t values. This is then checked within the functions. */
401 
402 #define BMScreateBlockMemory(csz,gbf) BMScreateBlockMemory_call( (csz), (gbf), __FILE__, __LINE__ )
403 #define BMSclearBlockMemory(mem) BMSclearBlockMemory_call( (mem), __FILE__, __LINE__ )
404 #define BMSdestroyBlockMemory(mem) BMSdestroyBlockMemory_call( (mem), __FILE__, __LINE__ )
405 
406 #define BMSallocBlockMemory(mem,ptr) ASSIGN((ptr), BMSallocBlockMemory_call((mem), sizeof(**(ptr)), __FILE__, __LINE__))
407 #define BMSallocBlockMemorySize(mem,ptr,size) ASSIGN((ptr), BMSallocBlockMemory_call((mem), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__))
408 #define BMSallocBlockMemoryArray(mem,ptr,num) ASSIGN((ptr), BMSallocBlockMemoryArray_call((mem), (size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__))
409 #define BMSallocClearBlockMemoryArray(mem,ptr,num) ASSIGN((ptr), BMSallocClearBlockMemoryArray_call((mem), (size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__))
410 #define BMSreallocBlockMemorySize(mem,ptr,oldsize,newsize) ASSIGN((ptr), BMSreallocBlockMemory_call((mem), (void*)(*(ptr)), \
411  (size_t)(ptrdiff_t)(oldsize), (size_t)(ptrdiff_t)(newsize), __FILE__, __LINE__))
412 #define BMSreallocBlockMemoryArray(mem,ptr,oldnum,newnum) ASSIGN((ptr), BMSreallocBlockMemoryArray_call((mem), (void*)(*(ptr)), \
413  (size_t)(ptrdiff_t)(oldnum), (size_t)(ptrdiff_t)(newnum), sizeof(**(ptr)), __FILE__, __LINE__))
414 #define BMSduplicateBlockMemory(mem, ptr, source) ASSIGN((ptr), BMSduplicateBlockMemory_call((mem), (const void*)(source), \
415  sizeof(**(ptr)), __FILE__, __LINE__ ))
416 #define BMSduplicateBlockMemoryArray(mem, ptr, source, num) ASSIGN((ptr), BMSduplicateBlockMemoryArray_call( (mem), (const void*)(source), \
417  (size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__ ))
418 
419 #define BMSfreeBlockMemory(mem,ptr) BMSfreeBlockMemory_call( (mem), (void**)(ptr), sizeof(**(ptr)), __FILE__, __LINE__ )
420 #define BMSfreeBlockMemoryNull(mem,ptr) BMSfreeBlockMemoryNull_call( (mem), (void**)(ptr), sizeof(**(ptr)), __FILE__, __LINE__ )
421 #define BMSfreeBlockMemoryArray(mem,ptr,num) BMSfreeBlockMemory_call( (mem), (void**)(ptr), (num)*sizeof(**(ptr)), __FILE__, __LINE__ )
422 #define BMSfreeBlockMemoryArrayNull(mem,ptr,num) BMSfreeBlockMemoryNull_call( (mem), (void**)(ptr), (num)*sizeof(**(ptr)), __FILE__, __LINE__ )
423 #define BMSfreeBlockMemorySize(mem,ptr,size) BMSfreeBlockMemory_call( (mem), (void**)(ptr), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__ )
424 #define BMSfreeBlockMemorySizeNull(mem,ptr,size) BMSfreeBlockMemory_call( (mem), (void**)(ptr), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__ )
425 
426 #define BMSgarbagecollectBlockMemory(mem) BMSgarbagecollectBlockMemory_call(mem)
427 #define BMSgetBlockMemoryAllocated(mem) BMSgetBlockMemoryAllocated_call(mem)
428 #define BMSgetBlockMemoryUsed(mem) BMSgetBlockMemoryUsed_call(mem)
429 #define BMSgetBlockMemoryUnused(mem) BMSgetBlockMemoryUnused_call(mem)
430 #define BMSgetBlockMemoryUsedMax(mem) BMSgetBlockMemoryUsedMax_call(mem)
431 #define BMSgetBlockMemoryUnusedMax(mem) BMSgetBlockMemoryUnusedMax_call(mem)
432 #define BMSgetBlockMemoryAllocatedMax(mem) BMSgetBlockMemoryAllocatedMax_call(mem)
433 #define BMSgetBlockPointerSize(mem,ptr) BMSgetBlockPointerSize_call((mem), (ptr))
434 #define BMSdisplayBlockMemory(mem) BMSdisplayBlockMemory_call(mem)
435 #define BMSblockMemoryCheckEmpty(mem) BMScheckEmptyBlockMemory_call(mem)
436 
437 #else
438 
439 /* block memory management mapped to standard memory management */
440 
441 #define BMScreateBlockMemory(csz,gbf) (SCIP_UNUSED(csz), SCIP_UNUSED(gbf), (void*)(0x01)) /* dummy to not return a NULL pointer */
442 #define BMSclearBlockMemory(mem) SCIP_UNUSED(mem)
443 #define BMSclearBlockMemoryNull(mem) SCIP_UNUSED(mem)
444 #define BMSdestroyBlockMemory(mem) SCIP_UNUSED(mem)
445 #define BMSdestroyBlockMemoryNull(mem) SCIP_UNUSED(mem)
446 #define BMSallocBlockMemory(mem,ptr) (SCIP_UNUSED(mem), BMSallocMemory(ptr))
447 #define BMSallocBlockMemoryArray(mem,ptr,num) (SCIP_UNUSED(mem), BMSallocMemoryArray(ptr,num))
448 #define BMSallocClearBlockMemoryArray(mem,ptr,num) (SCIP_UNUSED(mem), BMSallocClearMemoryArray(ptr,num))
449 #define BMSallocBlockMemorySize(mem,ptr,size) (SCIP_UNUSED(mem), BMSallocMemorySize(ptr,size))
450 #define BMSreallocBlockMemoryArray(mem,ptr,oldnum,newnum) (SCIP_UNUSED(mem), SCIP_UNUSED(oldnum), BMSreallocMemoryArray(ptr,newnum))
451 #define BMSreallocBlockMemorySize(mem,ptr,oldsize,newsize) (SCIP_UNUSED(mem), SCIP_UNUSED(oldsize), BMSreallocMemorySize(ptr,newsize))
452 #define BMSduplicateBlockMemory(mem, ptr, source) (SCIP_UNUSED(mem), BMSduplicateMemory(ptr,source))
453 #define BMSduplicateBlockMemoryArray(mem, ptr, source, num) (SCIP_UNUSED(mem), BMSduplicateMemoryArray(ptr,source,num))
454 #define BMSfreeBlockMemory(mem,ptr) (SCIP_UNUSED(mem), BMSfreeMemory(ptr))
455 #define BMSfreeBlockMemoryNull(mem,ptr) (SCIP_UNUSED(mem), BMSfreeMemoryNull(ptr))
456 #define BMSfreeBlockMemoryArray(mem,ptr,num) (SCIP_UNUSED(mem), SCIP_UNUSED(num), BMSfreeMemoryArray(ptr))
457 #define BMSfreeBlockMemoryArrayNull(mem,ptr,num) (SCIP_UNUSED(mem), SCIP_UNUSED(num), BMSfreeMemoryArrayNull(ptr))
458 #define BMSfreeBlockMemorySize(mem,ptr,size) (SCIP_UNUSED(mem), SCIP_UNUSED(size), BMSfreeMemory(ptr))
459 #define BMSfreeBlockMemorySizeNull(mem,ptr,size) (SCIP_UNUSED(mem), SCIP_UNUSED(size), BMSfreeMemoryNull(ptr))
460 #define BMSgarbagecollectBlockMemory(mem) SCIP_UNUSED(mem)
461 #define BMSgetBlockMemoryAllocated(mem) (SCIP_UNUSED(mem), 0LL)
462 #define BMSgetBlockMemoryUsed(mem) (SCIP_UNUSED(mem), 0LL)
463 #define BMSgetBlockMemoryUnused(mem) (SCIP_UNUSED(mem), 0LL)
464 #define BMSgetBlockMemoryUsedMax(mem) (SCIP_UNUSED(mem), 0LL)
465 #define BMSgetBlockMemoryUnusedMax(mem) (SCIP_UNUSED(mem), 0LL)
466 #define BMSgetBlockMemoryAllocatedMax(mem) (SCIP_UNUSED(mem), 0LL)
467 #define BMSgetBlockPointerSize(mem,ptr) (SCIP_UNUSED(mem), SCIP_UNUSED(ptr), 0)
468 #define BMSdisplayBlockMemory(mem) SCIP_UNUSED(mem)
469 #define BMSblockMemoryCheckEmpty(mem) (SCIP_UNUSED(mem), 0LL)
470 
471 #endif
472 
473 
474 /** creates a block memory allocation data structure */
475 extern
477  int initchunksize, /**< number of elements in the first chunk of each chunk block */
478  int garbagefactor, /**< garbage collector is called, if at least garbagefactor * avg. chunksize
479  * elements are free (-1: disable garbage collection) */
480  const char* filename, /**< source file of the function call */
481  int line /**< line number in source file of the function call */
482  );
483 
484 /** frees all chunk blocks in the block memory */
485 extern
487  BMS_BLKMEM* blkmem, /**< block memory */
488  const char* filename, /**< source file of the function call */
489  int line /**< line number in source file of the function call */
490  );
491 
492 /** clears and deletes block memory */
493 extern
495  BMS_BLKMEM** blkmem, /**< pointer to block memory */
496  const char* filename, /**< source file of the function call */
497  int line /**< line number in source file of the function call */
498  );
499 
500 /** allocates memory in the block memory pool */
501 extern
503  BMS_BLKMEM* blkmem, /**< block memory */
504  size_t size, /**< size of memory element to allocate */
505  const char* filename, /**< source file of the function call */
506  int line /**< line number in source file of the function call */
507  );
508 
509 /** allocates array in the block memory pool */
510 extern
512  BMS_BLKMEM* blkmem, /**< block memory */
513  size_t num, /**< size of array to be allocated */
514  size_t typesize, /**< size of each component */
515  const char* filename, /**< source file of the function call */
516  int line /**< line number in source file of the function call */
517  );
518 
519 /** allocates array in the block memory pool and clears it */
520 extern
522  BMS_BLKMEM* blkmem, /**< block memory */
523  size_t num, /**< size of array to be allocated */
524  size_t typesize, /**< size of each component */
525  const char* filename, /**< source file of the function call */
526  int line /**< line number in source file of the function call */
527  );
528 
529 /** resizes memory element in the block memory pool and copies the data */
530 extern
532  BMS_BLKMEM* blkmem, /**< block memory */
533  void* ptr, /**< memory element to reallocated */
534  size_t oldsize, /**< old size of memory element */
535  size_t newsize, /**< new size of memory element */
536  const char* filename, /**< source file of the function call */
537  int line /**< line number in source file of the function call */
538  );
539 
540 /** resizes array in the block memory pool and copies the data */
541 extern
543  BMS_BLKMEM* blkmem, /**< block memory */
544  void* ptr, /**< memory element to reallocated */
545  size_t oldnum, /**< old size of array */
546  size_t newnum, /**< new size of array */
547  size_t typesize, /**< size of each component */
548  const char* filename, /**< source file of the function call */
549  int line /**< line number in source file of the function call */
550  );
551 
552 /** duplicates memory element in the block memory pool and copies the data */
553 extern
555  BMS_BLKMEM* blkmem, /**< block memory */
556  const void* source, /**< memory element to duplicate */
557  size_t size, /**< size of memory elements */
558  const char* filename, /**< source file of the function call */
559  int line /**< line number in source file of the function call */
560  );
561 
562 /** duplicates array in the block memory pool and copies the data */
563 extern
565  BMS_BLKMEM* blkmem, /**< block memory */
566  const void* source, /**< memory element to duplicate */
567  size_t num, /**< size of array to be duplicated */
568  size_t typesize, /**< size of each component */
569  const char* filename, /**< source file of the function call */
570  int line /**< line number in source file of the function call */
571  );
572 
573 /** frees memory element in the block memory pool and sets pointer to NULL */
574 extern
576  BMS_BLKMEM* blkmem, /**< block memory */
577  void** ptr, /**< pointer to pointer to memory element to free */
578  size_t size, /**< size of memory element */
579  const char* filename, /**< source file of the function call */
580  int line /**< line number in source file of the function call */
581  );
582 
583 /** frees memory element in the block memory pool if pointer is not NULL and sets pointer to NULL */
584 extern
586  BMS_BLKMEM* blkmem, /**< block memory */
587  void** ptr, /**< pointer to pointer to memory element to free */
588  size_t size, /**< size of memory element */
589  const char* filename, /**< source file of the function call */
590  int line /**< line number in source file of the function call */
591  );
592 
593 /** calls garbage collection of block memory, frees chunks without allocated memory elements, and frees
594  * chunk blocks without any chunks
595  */
596 extern
598  BMS_BLKMEM* blkmem /**< block memory */
599  );
600 
601 /** returns the number of allocated bytes in the block memory */
602 extern
604  const BMS_BLKMEM* blkmem /**< block memory */
605  );
606 
607 /** returns the number of used bytes in the block memory */
608 extern
610  const BMS_BLKMEM* blkmem /**< block memory */
611  );
612 
613 /** returns the number of allocated but not used bytes in the block memory */
614 extern
616  const BMS_BLKMEM* blkmem /**< block memory */
617  );
618 
619 /** returns the maximal number of used bytes in the block memory */
620 extern
622  const BMS_BLKMEM* blkmem /**< block memory */
623  );
624 
625 /** returns the maximal number of allocated but not used bytes in the block memory */
626 extern
628  const BMS_BLKMEM* blkmem /**< block memory */
629  );
630 
631 /** returns the maximal number of allocated bytes in the block memory */
633  const BMS_BLKMEM* blkmem /**< block memory */
634  );
635 
636 /** returns the size of the given memory element; returns 0, if the element is not member of the block memory */
637 extern
639  const BMS_BLKMEM* blkmem, /**< block memory */
640  const void* ptr /**< memory element */
641  );
642 
643 /** outputs allocation diagnostics of block memory */
644 extern
646  const BMS_BLKMEM* blkmem /**< block memory */
647  );
648 
649 /** outputs error messages, if there are allocated elements in the block memory and returns number of unfreed bytes */
650 extern
652  const BMS_BLKMEM* blkmem /**< block memory */
653  );
654 
655 
656 
657 
658 
659 /***********************************************************
660  * Buffer Memory Management
661  *
662  * Efficient memory management for temporary objects
663  ***********************************************************/
664 
665 typedef struct BMS_BufMem BMS_BUFMEM; /**< buffer memory for temporary objects */
666 
667 /* Note: values that are passed as a size_t parameter are first converted to ptrdiff_t to be sure that negative numbers
668  * are extended to the larger size. Then they are converted to size_t. Thus, negative numbers are converted to very
669  * large size_t values. This is then checked within the functions. */
670 
671 #define BMSallocBufferMemory(mem,ptr) ASSIGN((ptr), BMSallocBufferMemory_call((mem), sizeof(**(ptr)), __FILE__, __LINE__))
672 #define BMSallocBufferMemorySize(mem,ptr,size) ASSIGN((ptr), BMSallocBufferMemory_call((mem), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__))
673 #define BMSreallocBufferMemorySize(mem,ptr,size) \
674  ASSIGN((ptr), BMSreallocBufferMemory_call((mem), (void*)(*(ptr)), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__))
675 #define BMSallocBufferMemoryArray(mem,ptr,num) ASSIGN((ptr), BMSallocBufferMemoryArray_call((mem), (size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__))
676 #define BMSallocClearBufferMemoryArray(mem,ptr,num) ASSIGN((ptr), BMSallocClearBufferMemoryArray_call((mem), (size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__))
677 #define BMSreallocBufferMemoryArray(mem,ptr,num) ASSIGN((ptr), BMSreallocBufferMemoryArray_call((mem), (void*)(*(ptr)), (size_t)(ptrdiff_t)(num), \
678  sizeof(**(ptr)), __FILE__, __LINE__))
679 #define BMSduplicateBufferMemory(mem,ptr,source,size) \
680  ASSIGN((ptr), BMSduplicateBufferMemory_call((mem), (const void*)(source), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__))
681 #define BMSduplicateBufferMemoryArray(mem,ptr,source,num) ASSIGN((ptr), BMSduplicateBufferMemoryArray_call((mem), \
682  (const void*)(source), (size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__))
683 
684 #define BMSfreeBufferMemory(mem,ptr) BMSfreeBufferMemory_call((mem), (void**)(ptr), __FILE__, __LINE__)
685 #define BMSfreeBufferMemoryNull(mem,ptr) BMSfreeBufferMemoryNull_call((mem), (void**)(ptr), __FILE__, __LINE__)
686 #define BMSfreeBufferMemoryArray(mem,ptr) BMSfreeBufferMemory_call((mem), (void**)(ptr), __FILE__, __LINE__)
687 #define BMSfreeBufferMemoryArrayNull(mem,ptr) BMSfreeBufferMemoryNull_call((mem), (void**)(ptr), __FILE__, __LINE__)
688 #define BMSfreeBufferMemorySize(mem,ptr) BMSfreeBufferMemory_call((mem), (void**)(ptr), __FILE__, __LINE__);
689 #define BMSfreeBufferMemorySizeNull(mem,ptr) BMSfreeBufferMemoryNull_call((mem), (void**)(ptr), __FILE__, __LINE__)
690 
691 #define BMScreateBufferMemory(fac,init,clean) BMScreateBufferMemory_call((fac), (init), (clean), __FILE__, __LINE__)
692 #define BMSdestroyBufferMemory(mem) BMSdestroyBufferMemory_call((mem), __FILE__, __LINE__)
693 
694 
695 /** creates memory buffer storage */
696 extern
698  double arraygrowfac, /**< memory growing factor for dynamically allocated arrays */
699  int arraygrowinit, /**< initial size of dynamically allocated arrays */
700  unsigned int clean, /**< should the memory blocks in the buffer be initialized to zero? */
701  const char* filename, /**< source file of the function call */
702  int line /**< line number in source file of the function call */
703  );
704 
705 /** destroys buffer memory */
706 extern
708  BMS_BUFMEM** buffer, /**< pointer to memory buffer storage */
709  const char* filename, /**< source file of the function call */
710  int line /**< line number in source file of the function call */
711  );
712 
713 /** set arraygrowfac */
714 extern
716  BMS_BUFMEM* buffer, /**< pointer to memory buffer storage */
717  double arraygrowfac /**< memory growing factor for dynamically allocated arrays */
718  );
719 
720 /** set arraygrowinit */
721 extern
723  BMS_BUFMEM* buffer, /**< pointer to memory buffer storage */
724  int arraygrowinit /**< initial size of dynamically allocated arrays */
725  );
726 
727 /** allocates the next unused buffer */
728 extern
730  BMS_BUFMEM* buffer, /**< memory buffer storage */
731  size_t size, /**< minimal required size of the buffer */
732  const char* filename, /**< source file of the function call */
733  int line /**< line number in source file of the function call */
734  );
735 
736 /** allocates the next unused buffer array */
737 extern
739  BMS_BUFMEM* buffer, /**< memory buffer storage */
740  size_t num, /**< size of array to be allocated */
741  size_t typesize, /**< size of components */
742  const char* filename, /**< source file of the function call */
743  int line /**< line number in source file of the function call */
744  );
745 
746 /** allocates the next unused buffer and clears it */
747 extern
749  BMS_BUFMEM* buffer, /**< memory buffer storage */
750  size_t num, /**< size of array to be allocated */
751  size_t typesize, /**< size of components */
752  const char* filename, /**< source file of the function call */
753  int line /**< line number in source file of the function call */
754  );
755 
756 /** reallocates the buffer to at least the given size */
757 extern
759  BMS_BUFMEM* buffer, /**< memory buffer storage */
760  void* ptr, /**< pointer to the allocated memory buffer */
761  size_t size, /**< minimal required size of the buffer */
762  const char* filename, /**< source file of the function call */
763  int line /**< line number in source file of the function call */
764  );
765 
766 /** reallocates an array in the buffer to at least the given size */
767 extern
769  BMS_BUFMEM* buffer, /**< memory buffer storage */
770  void* ptr, /**< pointer to the allocated memory buffer */
771  size_t num, /**< size of array to be allocated */
772  size_t typesize, /**< size of components */
773  const char* filename, /**< source file of the function call */
774  int line /**< line number in source file of the function call */
775  );
776 
777 /** allocates the next unused buffer and copies the given memory into the buffer */
778 extern
780  BMS_BUFMEM* buffer, /**< memory buffer storage */
781  const void* source, /**< memory block to copy into the buffer */
782  size_t size, /**< minimal required size of the buffer */
783  const char* filename, /**< source file of the function call */
784  int line /**< line number in source file of the function call */
785  );
786 
787 /** allocates an array in the next unused buffer and copies the given memory into the buffer */
788 extern
790  BMS_BUFMEM* buffer, /**< memory buffer storage */
791  const void* source, /**< memory block to copy into the buffer */
792  size_t num, /**< size of array to be allocated */
793  size_t typesize, /**< size of components */
794  const char* filename, /**< source file of the function call */
795  int line /**< line number in source file of the function call */
796  );
797 
798 /** frees a buffer and sets pointer to NULL */
799 extern
801  BMS_BUFMEM* buffer, /**< memory buffer storage */
802  void** ptr, /**< pointer to pointer to the allocated memory buffer */
803  const char* filename, /**< source file of the function call */
804  int line /**< line number in source file of the function call */
805  );
806 
807 /** frees a buffer if pointer is not NULL and sets pointer to NULL */
808 extern
810  BMS_BUFMEM* buffer, /**< memory buffer storage */
811  void** ptr, /**< pointer to pointer to the allocated memory buffer */
812  const char* filename, /**< source file of the function call */
813  int line /**< line number in source file of the function call */
814  );
815 
816 /** gets number of used buffers */
817 extern
819  BMS_BUFMEM* buffer /**< memory buffer storage */
820  );
821 
822 /** returns the number of allocated bytes in the buffer memory */
823 extern
824 long long BMSgetBufferMemoryUsed(
825  const BMS_BUFMEM* bufmem /**< buffer memory */
826  );
827 
828 /** outputs statistics about currently allocated buffers to the screen */
829 extern
831  BMS_BUFMEM* buffer /**< memory buffer storage */
832  );
833 
834 
835 #ifdef __cplusplus
836 }
837 #endif
838 
839 #endif
void * BMSreallocBufferMemory_call(BMS_BUFMEM *buffer, void *ptr, size_t size, const char *filename, int line)
Definition: memory.c:2956
void BMSfreeBufferMemoryNull_call(BMS_BUFMEM *buffer, void **ptr, const char *filename, int line)
Definition: memory.c:3142
void BMSdestroyChunkMemory_call(BMS_CHKMEM **chkmem, const char *filename, int line)
Definition: memory.c:1560
void * BMSallocBlockMemory_call(BMS_BLKMEM *blkmem, size_t size, const char *filename, int line)
Definition: memory.c:1945
struct BMS_ChkMem BMS_CHKMEM
Definition: memory.h:257
BMS_CHKMEM * BMScreateChunkMemory_call(size_t size, int initchunksize, int garbagefactor, const char *filename, int line)
Definition: memory.c:1518
void BMSfreeMemoryNull_call(void **ptr, const char *filename, int line)
Definition: memory.c:624
void * BMSallocChunkMemory_call(BMS_CHKMEM *chkmem, size_t size, const char *filename, int line)
Definition: memory.c:1580
void * BMSallocBlockMemoryArray_call(BMS_BLKMEM *blkmem, size_t num, size_t typesize, const char *filename, int line)
Definition: memory.c:1965
void * BMSallocClearBlockMemoryArray_call(BMS_BLKMEM *blkmem, size_t num, size_t typesize, const char *filename, int line)
Definition: memory.c:1986
void BMSclearBlockMemory_call(BMS_BLKMEM *blkmem, const char *filename, int line)
Definition: memory.c:1825
double arraygrowfac
Definition: memory.c:2548
void * BMSallocBufferMemoryArray_call(BMS_BUFMEM *buffer, size_t num, size_t typesize, const char *filename, int line)
Definition: memory.c:2844
size_t * size
Definition: memory.c:2542
int BMSisAligned(size_t size)
Definition: memory.c:754
void BMSdestroyBlockMemory_call(BMS_BLKMEM **blkmem, const char *filename, int line)
Definition: memory.c:1859
long long BMScheckEmptyBlockMemory_call(const BMS_BLKMEM *blkmem)
Definition: memory.c:2457
void * BMSreallocBlockMemoryArray_call(BMS_BLKMEM *blkmem, void *ptr, size_t oldnum, size_t newnum, size_t typesize, const char *filename, int line)
Definition: memory.c:2044
size_t BMSgetBlockPointerSize_call(const BMS_BLKMEM *blkmem, const void *ptr)
Definition: memory.c:2310
void * BMSduplicateChunkMemory_call(BMS_CHKMEM *chkmem, const void *source, size_t size, const char *filename, int line)
Definition: memory.c:1607
void BMSfreeChunkMemory_call(BMS_CHKMEM *chkmem, void **ptr, size_t size, const char *filename, int line)
Definition: memory.c:1629
long long BMSgetBlockMemoryUsedMax_call(const BMS_BLKMEM *blkmem)
Definition: memory.c:2280
long long BMSgetBlockMemoryAllocated_call(const BMS_BLKMEM *blkmem)
Definition: memory.c:2250
void * BMSallocBufferMemory_call(BMS_BUFMEM *buffer, size_t size, const char *filename, int line)
Definition: memory.c:2824
void BMSsetBufferMemoryArraygrowinit(BMS_BUFMEM *buffer, int arraygrowinit)
Definition: memory.c:2635
void * BMSallocClearBufferMemoryArray_call(BMS_BUFMEM *buffer, size_t num, size_t typesize, const char *filename, int line)
Definition: memory.c:2865
void * BMSduplicateMemory_call(const void *source, size_t size, const char *filename, int line)
Definition: memory.c:562
void * BMSreallocBlockMemory_call(BMS_BLKMEM *blkmem, void *ptr, size_t oldsize, size_t newsize, const char *filename, int line)
Definition: memory.c:2004
void * BMSreallocMemoryArray_call(void *ptr, size_t num, size_t typesize, const char *filename, int line)
Definition: memory.c:474
void * BMSallocMemoryArray_call(size_t num, size_t typesize, const char *filename, int line)
Definition: memory.c:394
void BMSdestroyBufferMemory_call(BMS_BUFMEM **buffer, const char *filename, int line)
Definition: memory.c:2590
void BMSdisplayMemory_call(void)
Definition: memory.c:289
BMS_BLKMEM * BMScreateBlockMemory_call(int initchunksize, int garbagefactor, const char *filename, int line)
Definition: memory.c:1791
void BMSclearMemory_call(void *ptr, size_t size)
Definition: memory.c:517
void BMSfreeBufferMemory_call(BMS_BUFMEM *buffer, void **ptr, const char *filename, int line)
Definition: memory.c:3119
void * BMSduplicateBlockMemory_call(BMS_BLKMEM *blkmem, const void *source, size_t size, const char *filename, int line)
Definition: memory.c:2083
void BMScheckEmptyMemory_call(void)
Definition: memory.c:299
void BMSgarbagecollectChunkMemory_call(BMS_CHKMEM *chkmem)
Definition: memory.c:1682
void * BMSreallocMemory_call(void *ptr, size_t size, const char *filename, int line)
Definition: memory.c:434
long long BMSgetBlockMemoryUsed_call(const BMS_BLKMEM *blkmem)
Definition: memory.c:2260
long long BMSgetBlockMemoryAllocatedMax_call(const BMS_BLKMEM *blkmem)
Definition: memory.c:2300
void * BMSduplicateBlockMemoryArray_call(BMS_BLKMEM *blkmem, const void *source, size_t num, size_t typesize, const char *filename, int line)
Definition: memory.c:2103
void BMSfreeBlockMemoryNull_call(BMS_BLKMEM *blkmem, void **ptr, size_t size, const char *filename, int line)
Definition: memory.c:2195
long long BMSgetChunkMemoryUsed_call(const BMS_CHKMEM *chkmem)
Definition: memory.c:1692
void BMSgarbagecollectBlockMemory_call(BMS_BLKMEM *blkmem)
Definition: memory.c:2216
void BMSprintBufferMemory(BMS_BUFMEM *buffer)
Definition: memory.c:3190
void * BMSallocMemory_call(size_t size, const char *filename, int line)
Definition: memory.c:358
unsigned int arraygrowinit
Definition: memory.c:2549
void BMSfreeMemory_call(void **ptr, const char *filename, int line)
Definition: memory.c:601
BMS_BUFMEM * BMScreateBufferMemory_call(double arraygrowfac, int arraygrowinit, unsigned int clean, const char *filename, int line)
Definition: memory.c:2554
void * BMSallocClearMemory_call(size_t num, size_t typesize, const char *filename, int line)
Definition: memory.c:319
long long BMSgetBlockMemoryUnusedMax_call(const BMS_BLKMEM *blkmem)
Definition: memory.c:2290
void BMSsetBufferMemoryArraygrowfac(BMS_BUFMEM *buffer, double arraygrowfac)
Definition: memory.c:2623
void * BMSduplicateBufferMemory_call(BMS_BUFMEM *buffer, const void *source, size_t size, const char *filename, int line)
Definition: memory.c:2999
void BMSmoveMemory_call(void *ptr, const void *source, size_t size)
Definition: memory.c:547
void * BMSreallocBufferMemoryArray_call(BMS_BUFMEM *buffer, void *ptr, size_t num, size_t typesize, const char *filename, int line)
Definition: memory.c:2977
void BMSfreeChunkMemoryNull_call(BMS_CHKMEM *chkmem, void **ptr, size_t size, const char *filename, int line)
Definition: memory.c:1658
long long BMSgetBlockMemoryUnused_call(const BMS_BLKMEM *blkmem)
Definition: memory.c:2270
size_t BMSgetNUsedBufferMemory(BMS_BUFMEM *buffer)
Definition: memory.c:3162
void BMSalignMemsize(size_t *size)
Definition: memory.c:745
void BMScopyMemory_call(void *ptr, const void *source, size_t size)
Definition: memory.c:530
void BMSfreeBlockMemory_call(BMS_BLKMEM *blkmem, void **ptr, size_t size, const char *filename, int line)
Definition: memory.c:2173
void BMSdisplayBlockMemory_call(const BMS_BLKMEM *blkmem)
Definition: memory.c:2330
void BMSclearChunkMemory_call(BMS_CHKMEM *chkmem, const char *filename, int line)
Definition: memory.c:1542
size_t BMSgetPointerSize_call(const void *ptr)
Definition: memory.c:281
struct BMS_BlkMem BMS_BLKMEM
Definition: memory.h:392
unsigned int clean
Definition: memory.c:2545
long long BMSgetMemoryUsed_call(void)
Definition: memory.c:309
void * BMSduplicateMemoryArray_call(const void *source, size_t num, size_t typesize, const char *filename, int line)
Definition: memory.c:581
long long BMSgetBufferMemoryUsed(const BMS_BUFMEM *bufmem)
Definition: memory.c:3172
void * BMSduplicateBufferMemoryArray_call(BMS_BUFMEM *buffer, const void *source, size_t num, size_t typesize, const char *filename, int line)
Definition: memory.c:3022