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 /* define if not already existing to make file independent from def.h */
61 #ifndef SCIP_UNUSED
62 #define SCIP_UNUSED(x) ((void) (x))
63 #endif
64 
65 
66 /*************************************************************************************
67  * Standard Memory Management
68  *
69  * In debug mode, these methods extend malloc() and free() by logging all currently
70  * allocated memory elements in an allocation list. This can be used as a simple leak
71  * detection.
72  *************************************************************************************/
73 
74 /* Note: values that are passed as a size_t parameter are first converted to ptrdiff_t to be sure that negative numbers
75  * are extended to the larger size. Then they are converted to size_t. Thus, negative numbers are converted to very
76  * large size_t values. This is then checked within the functions. */
77 
78 #define BMSallocMemory(ptr) ASSIGN((ptr), BMSallocMemory_call( sizeof(**(ptr)), __FILE__, __LINE__ ))
79 #define BMSallocMemorySize(ptr,size) ASSIGN((ptr), BMSallocMemory_call( (size_t)(ptrdiff_t)(size), __FILE__, __LINE__ ))
80 #define BMSallocMemoryCPP(size) BMSallocMemory_call( (size_t)(ptrdiff_t)(size), __FILE__, __LINE__ )
81 #define BMSallocClearMemorySize(ptr,size) ASSIGN((ptr), BMSallocClearMemory_call((size_t)(1), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__ ))
82 #define BMSallocMemoryArray(ptr,num) ASSIGN((ptr), BMSallocMemoryArray_call((size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__ ))
83 #define BMSallocMemoryArrayCPP(num,size) BMSallocMemoryArray_call( (size_t)(ptrdiff_t)(num), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__ )
84 #define BMSallocClearMemoryArray(ptr,num) ASSIGN((ptr), BMSallocClearMemory_call((size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__ ))
85 #define BMSreallocMemorySize(ptr,size) ASSIGN((ptr), BMSreallocMemory_call((void*)(*(ptr)), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__ ))
86 #define BMSreallocMemoryArray(ptr,num) ASSIGN((ptr), BMSreallocMemoryArray_call( *(ptr), (size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__ ))
87 
88 #define BMSclearMemory(ptr) BMSclearMemory_call( (void*)(ptr), sizeof(*(ptr)) )
89 #define BMSclearMemoryArray(ptr, num) BMSclearMemory_call( (void*)(ptr), (size_t)(ptrdiff_t)(num)*sizeof(*(ptr)) )
90 #define BMSclearMemorySize(ptr, size) BMSclearMemory_call( (void*)(ptr), (size_t)(ptrdiff_t)(size) )
91 
92 #define BMScopyMemory(ptr, source) BMScopyMemory_call( (void*)(ptr), (const void*)(source), sizeof(*(ptr)) )
93 #define BMScopyMemoryArray(ptr, source, num) BMScopyMemory_call( (void*)(ptr), (const void*)(source), (size_t)(ptrdiff_t)(num)*sizeof(*(ptr)) )
94 #define BMScopyMemorySize(ptr, source, size) BMScopyMemory_call( (void*)(ptr), (const void*)(source), (size_t)(ptrdiff_t)(size) )
95 
96 #define BMSmoveMemory(ptr, source) BMSmoveMemory_call( (void*)(ptr), (const void*)(source), sizeof(*(ptr)) )
97 #define BMSmoveMemoryArray(ptr, source, num) BMSmoveMemory_call( (void*)(ptr), (const void*)(source), (size_t)(ptrdiff_t)(num) * sizeof(*(ptr)) )
98 #define BMSmoveMemorySize(ptr, source, size) BMSmoveMemory_call( (void*)(ptr), (const void*)(source), (size_t)(ptrdiff_t)(size) )
99 
100 #define BMSduplicateMemory(ptr, source) ASSIGN((ptr), BMSduplicateMemory_call( (const void*)(source), sizeof(**(ptr)), __FILE__, __LINE__ ))
101 #define BMSduplicateMemorySize(ptr, source, size) ASSIGN((ptr), BMSduplicateMemory_call( (const void*)(source), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__ ))
102 #define BMSduplicateMemoryArray(ptr, source, num) ASSIGN((ptr), BMSduplicateMemoryArray_call( (const void*)(source), (size_t)(ptrdiff_t)(num), \
103  sizeof(**(ptr)), __FILE__, __LINE__ ))
104 #define BMSfreeMemory(ptr) BMSfreeMemory_call( (void**)(ptr), __FILE__, __LINE__ )
105 #define BMSfreeMemoryNull(ptr) BMSfreeMemoryNull_call( (void**)(ptr), __FILE__, __LINE__ )
106 #define BMSfreeMemoryArray(ptr) BMSfreeMemory_call( (void**)(ptr), __FILE__, __LINE__ )
107 #define BMSfreeMemoryArrayNull(ptr) BMSfreeMemoryNull_call( (void**)(ptr), __FILE__, __LINE__ )
108 #define BMSfreeMemorySize(ptr) BMSfreeMemory_call( (void**)(ptr), __FILE__, __LINE__ )
109 #define BMSfreeMemorySizeNull(ptr) BMSfreeMemoryNull_call( (void**)(ptr), __FILE__, __LINE__ )
110 
111 #ifndef NDEBUG
112 #define BMSgetPointerSize(ptr) BMSgetPointerSize_call(ptr)
113 #define BMSdisplayMemory() BMSdisplayMemory_call()
114 #define BMScheckEmptyMemory() BMScheckEmptyMemory_call()
115 #define BMSgetMemoryUsed() BMSgetMemoryUsed_call()
116 #else
117 #define BMSgetPointerSize(ptr) 0
118 #define BMSdisplayMemory() /**/
119 #define BMScheckEmptyMemory() /**/
120 #define BMSgetMemoryUsed() 0LL
121 #endif
122 
123 /** allocates array and initializes it with 0; returns NULL if memory allocation failed */
124 extern
126  size_t num, /**< number of memory element to allocate */
127  size_t typesize, /**< size of memory element to allocate */
128  const char* filename, /**< source file where the allocation is performed */
129  int line /**< line number in source file where the allocation is performed */
130  );
131 
132 /** allocates memory; returns NULL if memory allocation failed */
133 extern
134 void* BMSallocMemory_call(
135  size_t size, /**< size of memory element to allocate */
136  const char* filename, /**< source file where the allocation is performed */
137  int line /**< line number in source file where the allocation is performed */
138  );
139 
140 /** allocates array; returns NULL if memory allocation failed */
141 extern
143  size_t num, /**< number of components of array to allocate */
144  size_t typesize, /**< size of each component */
145  const char* filename, /**< source file where the allocation is performed */
146  int line /**< line number in source file where the allocation is performed */
147  );
148 
149 /** allocates memory; returns NULL if memory allocation failed */
150 extern
152  void* ptr, /**< pointer to memory to reallocate */
153  size_t size, /**< new size of memory element */
154  const char* filename, /**< source file where the reallocation is performed */
155  int line /**< line number in source file where the reallocation is performed */
156  );
157 
158 /** reallocates array; returns NULL if memory allocation failed */
159 extern
161  void* ptr, /**< pointer to memory to reallocate */
162  size_t num, /**< number of components of array to allocate */
163  size_t typesize, /**< size of each component */
164  const char* filename, /**< source file where the reallocation is performed */
165  int line /**< line number in source file where the reallocation is performed */
166  );
167 
168 /** clears a memory element (i.e. fills it with zeros) */
169 extern
171  void* ptr, /**< pointer to memory element */
172  size_t size /**< size of memory element */
173  );
174 
175 /** copies the contents of one memory element into another memory element */
176 extern
177 void BMScopyMemory_call(
178  void* ptr, /**< pointer to target memory element */
179  const void* source, /**< pointer to source memory element */
180  size_t size /**< size of memory element to copy */
181  );
182 
183 /** moves the contents of one memory element into another memory element, should be used if both elements overlap,
184  * otherwise BMScopyMemory is faster
185  */
186 extern
187 void BMSmoveMemory_call(
188  void* ptr, /**< pointer to target memory element */
189  const void* source, /**< pointer to source memory element */
190  size_t size /**< size of memory element to copy */
191  );
192 
193 /** allocates memory and copies the contents of the given memory element into the new memory element */
194 extern
196  const void* source, /**< pointer to source memory element */
197  size_t size, /**< size of memory element to copy */
198  const char* filename, /**< source file where the duplication is performed */
199  int line /**< line number in source file where the duplication is performed */
200  );
201 
202 /** allocates array and copies the contents of the given source array into the new array */
203 extern
205  const void* source, /**< pointer to source memory element */
206  size_t num, /**< number of components of array to allocate */
207  size_t typesize, /**< size of each component */
208  const char* filename, /**< source file where the duplication is performed */
209  int line /**< line number in source file where the duplication is performed */
210  );
211 
212 /** frees an allocated memory element and sets pointer to NULL */
213 extern
214 void BMSfreeMemory_call(
215  void** ptr, /**< pointer to pointer to memory element */
216  const char* filename, /**< source file where the deallocation is performed */
217  int line /**< line number in source file where the deallocation is performed */
218  );
219 
220 /** frees an allocated memory element if pointer is not NULL and sets pointer to NULL */
221 extern
223  void** ptr, /**< pointer to pointer to memory element */
224  const char* filename, /**< source file where the deallocation is performed */
225  int line /**< line number in source file where the deallocation is performed */
226  );
227 
228 /** returns the size of an allocated memory element */
229 extern
231  const void* ptr /**< pointer to allocated memory */
232  );
233 
234 /** outputs information about currently allocated memory to the screen */
235 extern
237  void
238  );
239 
240 /** displays a warning message on the screen, if allocated memory exists */
241 extern
243  void
244  );
245 
246 /** returns total number of allocated bytes */
247 extern
248 long long BMSgetMemoryUsed_call(
249  void
250  );
251 
252 
253 
254 
255 /********************************************************************
256  * Chunk Memory Management
257  *
258  * Efficient memory management for multiple objects of the same size
259  ********************************************************************/
260 
261 typedef struct BMS_ChkMem BMS_CHKMEM; /**< collection of memory chunks of the same element size */
262 
263 
264 #ifndef BMS_NOBLOCKMEM
265 
266 #define BMScreateChunkMemory(sz,isz,gbf) BMScreateChunkMemory_call( (sz), (isz), (gbf), __FILE__, __LINE__ )
267 #define BMSclearChunkMemory(mem) BMSclearChunkMemory_call( (mem), __FILE__, __LINE__ )
268 #define BMSdestroyChunkMemory(mem) BMSdestroyChunkMemory_call( (mem), __FILE__, __LINE__ )
269 
270 #define BMSallocChunkMemory(mem,ptr) ASSIGN((ptr), BMSallocChunkMemory_call((mem), sizeof(**(ptr)), __FILE__, __LINE__))
271 #define BMSduplicateChunkMemory(mem, ptr, source) ASSIGN((ptr), BMSduplicateChunkMemory_call((mem), (const void*)(source), \
272  sizeof(**(ptr)), __FILE__, __LINE__ ))
273 #define BMSfreeChunkMemory(mem,ptr) BMSfreeChunkMemory_call( (mem), (void**)(ptr), sizeof(**(ptr)), __FILE__, __LINE__ )
274 #define BMSfreeChunkMemoryNull(mem,ptr) BMSfreeChunkMemoryNull_call( (mem), (void**)(ptr) )
275 #define BMSgarbagecollectChunkMemory(mem) BMSgarbagecollectChunkMemory_call(mem)
276 #define BMSgetChunkMemoryUsed(mem) BMSgetChunkMemoryUsed_call(mem)
277 
278 #else
279 
280 /* block memory management mapped to standard memory management */
281 
282 #define BMScreateChunkMemory(sz,isz,gbf) (void*)(0x01) /* dummy to not return a NULL pointer */
283 #define BMSclearChunkMemory(mem) /**/
284 #define BMSclearChunkMemoryNull(mem) /**/
285 #define BMSdestroyChunkMemory(mem) /**/
286 #define BMSdestroyChunkMemoryNull(mem) /**/
287 #define BMSallocChunkMemory(mem,ptr) BMSallocMemory(ptr)
288 #define BMSduplicateChunkMemory(mem, ptr, source) BMSduplicateMemory(ptr,source)
289 #define BMSfreeChunkMemory(mem,ptr) BMSfreeMemory(ptr)
290 #define BMSfreeChunkMemoryNull(mem,ptr) BMSfreeMemoryNull(ptr)
291 #define BMSgarbagecollectChunkMemory(mem) /**/
292 #define BMSgetChunkMemoryUsed(mem) 0LL
293 
294 #endif
295 
296 
297 /** aligns the given byte size corresponding to the minimal alignment for chunk and block memory */
298 extern
299 void BMSalignMemsize(
300  size_t* size /**< pointer to the size to align */
301  );
302 
303 /** checks whether the given size meets the alignment conditions for chunk and block memory */
304 extern
305 int BMSisAligned(
306  size_t size /**< size to check for alignment */
307  );
308 
309 /** creates a new chunk block data structure */
310 extern
312  size_t size, /**< element size of the chunk block */
313  int initchunksize, /**< number of elements in the first chunk of the chunk block */
314  int garbagefactor, /**< garbage collector is called, if at least garbagefactor * avg. chunksize
315  * elements are free (-1: disable garbage collection) */
316  const char* filename, /**< source file of the function call */
317  int line /**< line number in source file of the function call */
318  );
319 
320 /** clears a chunk block data structure */
321 extern
323  BMS_CHKMEM* chkmem, /**< chunk block */
324  const char* filename, /**< source file of the function call */
325  int line /**< line number in source file of the function call */
326  );
327 
328 /** destroys and frees a chunk block data structure */
329 extern
331  BMS_CHKMEM** chkmem, /**< pointer to chunk block */
332  const char* filename, /**< source file of the function call */
333  int line /**< line number in source file of the function call */
334  );
335 
336 /** allocates a memory element of the given chunk block */
337 extern
339  BMS_CHKMEM* chkmem, /**< chunk block */
340  size_t size, /**< size of memory element to allocate (only needed for sanity check) */
341  const char* filename, /**< source file of the function call */
342  int line /**< line number in source file of the function call */
343  );
344 
345 /** duplicates a given memory element by allocating a new element of the same chunk block and copying the data */
346 extern
348  BMS_CHKMEM* chkmem, /**< chunk block */
349  const void* source, /**< source memory element */
350  size_t size, /**< size of memory element to allocate (only needed for sanity check) */
351  const char* filename, /**< source file of the function call */
352  int line /**< line number in source file of the function call */
353  );
354 
355 /** frees a memory element of the given chunk block and sets pointer to NULL */
356 extern
358  BMS_CHKMEM* chkmem, /**< chunk block */
359  void** ptr, /**< pointer to pointer to memory element to free */
360  size_t size, /**< size of memory element to allocate (only needed for sanity check) */
361  const char* filename, /**< source file of the function call */
362  int line /**< line number in source file of the function call */
363  );
364 
365 /** frees a memory element of the given chunk block if pointer is not NULL and sets pointer to NULL */
366 extern
368  BMS_CHKMEM* chkmem, /**< chunk block */
369  void** ptr, /**< pointer to pointer to memory element to free */
370  size_t size, /**< size of memory element to allocate (only needed for sanity check) */
371  const char* filename, /**< source file of the function call */
372  int line /**< line number in source file of the function call */
373  );
374 
375 /** calls garbage collection of chunk block and frees chunks without allocated memory elements */
376 extern
378  BMS_CHKMEM* chkmem /**< chunk block */
379  );
380 
381 /** returns the number of allocated bytes in the chunk block */
382 extern
384  const BMS_CHKMEM* chkmem /**< chunk block */
385  );
386 
387 
388 
389 
390 /***********************************************************
391  * Block Memory Management
392  *
393  * Efficient memory management for objects of varying sizes
394  ***********************************************************/
395 
396 typedef struct BMS_BlkMem BMS_BLKMEM; /**< block memory: collection of chunk blocks */
397 
398 #ifndef BMS_NOBLOCKMEM
399 
400 /* block memory methods for faster memory access */
401 
402 /* Note: values that are passed as a size_t parameter are first converted to ptrdiff_t to be sure that negative numbers
403  * are extended to the larger size. Then they are converted to size_t. Thus, negative numbers are converted to very
404  * large size_t values. This is then checked within the functions. */
405 
406 #define BMScreateBlockMemory(csz,gbf) BMScreateBlockMemory_call( (csz), (gbf), __FILE__, __LINE__ )
407 #define BMSclearBlockMemory(mem) BMSclearBlockMemory_call( (mem), __FILE__, __LINE__ )
408 #define BMSdestroyBlockMemory(mem) BMSdestroyBlockMemory_call( (mem), __FILE__, __LINE__ )
409 
410 #define BMSallocBlockMemory(mem,ptr) ASSIGN((ptr), BMSallocBlockMemory_call((mem), sizeof(**(ptr)), __FILE__, __LINE__))
411 #define BMSallocBlockMemorySize(mem,ptr,size) ASSIGN((ptr), BMSallocBlockMemory_call((mem), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__))
412 #define BMSallocBlockMemoryArray(mem,ptr,num) ASSIGN((ptr), BMSallocBlockMemoryArray_call((mem), (size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__))
413 #define BMSallocClearBlockMemoryArray(mem,ptr,num) ASSIGN((ptr), BMSallocClearBlockMemoryArray_call((mem), (size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__))
414 #define BMSreallocBlockMemorySize(mem,ptr,oldsize,newsize) ASSIGN((ptr), BMSreallocBlockMemory_call((mem), (void*)(*(ptr)), \
415  (size_t)(ptrdiff_t)(oldsize), (size_t)(ptrdiff_t)(newsize), __FILE__, __LINE__))
416 #define BMSreallocBlockMemoryArray(mem,ptr,oldnum,newnum) ASSIGN((ptr), BMSreallocBlockMemoryArray_call((mem), (void*)(*(ptr)), \
417  (size_t)(ptrdiff_t)(oldnum), (size_t)(ptrdiff_t)(newnum), sizeof(**(ptr)), __FILE__, __LINE__))
418 #define BMSduplicateBlockMemory(mem, ptr, source) ASSIGN((ptr), BMSduplicateBlockMemory_call((mem), (const void*)(source), \
419  sizeof(**(ptr)), __FILE__, __LINE__ ))
420 #define BMSduplicateBlockMemoryArray(mem, ptr, source, num) ASSIGN((ptr), BMSduplicateBlockMemoryArray_call( (mem), (const void*)(source), \
421  (size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__ ))
422 
423 #define BMSfreeBlockMemory(mem,ptr) BMSfreeBlockMemory_call( (mem), (void**)(ptr), sizeof(**(ptr)), __FILE__, __LINE__ )
424 #define BMSfreeBlockMemoryNull(mem,ptr) BMSfreeBlockMemoryNull_call( (mem), (void**)(ptr), sizeof(**(ptr)), __FILE__, __LINE__ )
425 #define BMSfreeBlockMemoryArray(mem,ptr,num) BMSfreeBlockMemory_call( (mem), (void**)(ptr), (num)*sizeof(**(ptr)), __FILE__, __LINE__ )
426 #define BMSfreeBlockMemoryArrayNull(mem,ptr,num) BMSfreeBlockMemoryNull_call( (mem), (void**)(ptr), (num)*sizeof(**(ptr)), __FILE__, __LINE__ )
427 #define BMSfreeBlockMemorySize(mem,ptr,size) BMSfreeBlockMemory_call( (mem), (void**)(ptr), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__ )
428 #define BMSfreeBlockMemorySizeNull(mem,ptr,size) BMSfreeBlockMemory_call( (mem), (void**)(ptr), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__ )
429 
430 #define BMSgarbagecollectBlockMemory(mem) BMSgarbagecollectBlockMemory_call(mem)
431 #define BMSgetBlockMemoryAllocated(mem) BMSgetBlockMemoryAllocated_call(mem)
432 #define BMSgetBlockMemoryUsed(mem) BMSgetBlockMemoryUsed_call(mem)
433 #define BMSgetBlockMemoryUnused(mem) BMSgetBlockMemoryUnused_call(mem)
434 #define BMSgetBlockMemoryUsedMax(mem) BMSgetBlockMemoryUsedMax_call(mem)
435 #define BMSgetBlockMemoryUnusedMax(mem) BMSgetBlockMemoryUnusedMax_call(mem)
436 #define BMSgetBlockMemoryAllocatedMax(mem) BMSgetBlockMemoryAllocatedMax_call(mem)
437 #define BMSgetBlockPointerSize(mem,ptr) BMSgetBlockPointerSize_call((mem), (ptr))
438 #define BMSdisplayBlockMemory(mem) BMSdisplayBlockMemory_call(mem)
439 #define BMSblockMemoryCheckEmpty(mem) BMScheckEmptyBlockMemory_call(mem)
440 
441 #else
442 
443 /* block memory management mapped to standard memory management */
444 
445 #define BMScreateBlockMemory(csz,gbf) (SCIP_UNUSED(csz), SCIP_UNUSED(gbf), (void*)(0x01)) /* dummy to not return a NULL pointer */
446 #define BMSclearBlockMemory(mem) SCIP_UNUSED(mem)
447 #define BMSclearBlockMemoryNull(mem) SCIP_UNUSED(mem)
448 #define BMSdestroyBlockMemory(mem) SCIP_UNUSED(mem)
449 #define BMSdestroyBlockMemoryNull(mem) SCIP_UNUSED(mem)
450 #define BMSallocBlockMemory(mem,ptr) (SCIP_UNUSED(mem), BMSallocMemory(ptr))
451 #define BMSallocBlockMemoryArray(mem,ptr,num) (SCIP_UNUSED(mem), BMSallocMemoryArray(ptr,num))
452 #define BMSallocClearBlockMemoryArray(mem,ptr,num) (SCIP_UNUSED(mem), BMSallocClearMemoryArray(ptr,num))
453 #define BMSallocBlockMemorySize(mem,ptr,size) (SCIP_UNUSED(mem), BMSallocMemorySize(ptr,size))
454 #define BMSreallocBlockMemoryArray(mem,ptr,oldnum,newnum) (SCIP_UNUSED(mem), SCIP_UNUSED(oldnum), BMSreallocMemoryArray(ptr,newnum))
455 #define BMSreallocBlockMemorySize(mem,ptr,oldsize,newsize) (SCIP_UNUSED(mem), SCIP_UNUSED(oldsize), BMSreallocMemorySize(ptr,newsize))
456 #define BMSduplicateBlockMemory(mem, ptr, source) (SCIP_UNUSED(mem), BMSduplicateMemory(ptr,source))
457 #define BMSduplicateBlockMemoryArray(mem, ptr, source, num) (SCIP_UNUSED(mem), BMSduplicateMemoryArray(ptr,source,num))
458 #define BMSfreeBlockMemory(mem,ptr) (SCIP_UNUSED(mem), BMSfreeMemory(ptr))
459 #define BMSfreeBlockMemoryNull(mem,ptr) (SCIP_UNUSED(mem), BMSfreeMemoryNull(ptr))
460 #define BMSfreeBlockMemoryArray(mem,ptr,num) (SCIP_UNUSED(mem), SCIP_UNUSED(num), BMSfreeMemoryArray(ptr))
461 #define BMSfreeBlockMemoryArrayNull(mem,ptr,num) (SCIP_UNUSED(mem), SCIP_UNUSED(num), BMSfreeMemoryArrayNull(ptr))
462 #define BMSfreeBlockMemorySize(mem,ptr,size) (SCIP_UNUSED(mem), SCIP_UNUSED(size), BMSfreeMemory(ptr))
463 #define BMSfreeBlockMemorySizeNull(mem,ptr,size) (SCIP_UNUSED(mem), SCIP_UNUSED(size), BMSfreeMemoryNull(ptr))
464 #define BMSgarbagecollectBlockMemory(mem) SCIP_UNUSED(mem)
465 #define BMSgetBlockMemoryAllocated(mem) (SCIP_UNUSED(mem), 0LL)
466 #define BMSgetBlockMemoryUsed(mem) (SCIP_UNUSED(mem), 0LL)
467 #define BMSgetBlockMemoryUnused(mem) (SCIP_UNUSED(mem), 0LL)
468 #define BMSgetBlockMemoryUsedMax(mem) (SCIP_UNUSED(mem), 0LL)
469 #define BMSgetBlockMemoryUnusedMax(mem) (SCIP_UNUSED(mem), 0LL)
470 #define BMSgetBlockMemoryAllocatedMax(mem) (SCIP_UNUSED(mem), 0LL)
471 #define BMSgetBlockPointerSize(mem,ptr) (SCIP_UNUSED(mem), SCIP_UNUSED(ptr), 0)
472 #define BMSdisplayBlockMemory(mem) SCIP_UNUSED(mem)
473 #define BMSblockMemoryCheckEmpty(mem) (SCIP_UNUSED(mem), 0LL)
474 
475 #endif
476 
477 
478 /** creates a block memory allocation data structure */
479 extern
481  int initchunksize, /**< number of elements in the first chunk of each chunk block */
482  int garbagefactor, /**< garbage collector is called, if at least garbagefactor * avg. chunksize
483  * elements are free (-1: disable garbage collection) */
484  const char* filename, /**< source file of the function call */
485  int line /**< line number in source file of the function call */
486  );
487 
488 /** frees all chunk blocks in the block memory */
489 extern
491  BMS_BLKMEM* blkmem, /**< block memory */
492  const char* filename, /**< source file of the function call */
493  int line /**< line number in source file of the function call */
494  );
495 
496 /** clears and deletes block memory */
497 extern
499  BMS_BLKMEM** blkmem, /**< pointer to block memory */
500  const char* filename, /**< source file of the function call */
501  int line /**< line number in source file of the function call */
502  );
503 
504 /** allocates memory in the block memory pool */
505 extern
507  BMS_BLKMEM* blkmem, /**< block memory */
508  size_t size, /**< size of memory element to allocate */
509  const char* filename, /**< source file of the function call */
510  int line /**< line number in source file of the function call */
511  );
512 
513 /** allocates array in the block memory pool */
514 extern
516  BMS_BLKMEM* blkmem, /**< block memory */
517  size_t num, /**< size of array to be allocated */
518  size_t typesize, /**< size of each component */
519  const char* filename, /**< source file of the function call */
520  int line /**< line number in source file of the function call */
521  );
522 
523 /** allocates array in the block memory pool and clears it */
524 extern
526  BMS_BLKMEM* blkmem, /**< block memory */
527  size_t num, /**< size of array to be allocated */
528  size_t typesize, /**< size of each component */
529  const char* filename, /**< source file of the function call */
530  int line /**< line number in source file of the function call */
531  );
532 
533 /** resizes memory element in the block memory pool and copies the data */
534 extern
536  BMS_BLKMEM* blkmem, /**< block memory */
537  void* ptr, /**< memory element to reallocated */
538  size_t oldsize, /**< old size of memory element */
539  size_t newsize, /**< new size of memory element */
540  const char* filename, /**< source file of the function call */
541  int line /**< line number in source file of the function call */
542  );
543 
544 /** resizes array in the block memory pool and copies the data */
545 extern
547  BMS_BLKMEM* blkmem, /**< block memory */
548  void* ptr, /**< memory element to reallocated */
549  size_t oldnum, /**< old size of array */
550  size_t newnum, /**< new size of array */
551  size_t typesize, /**< size of each component */
552  const char* filename, /**< source file of the function call */
553  int line /**< line number in source file of the function call */
554  );
555 
556 /** duplicates memory element in the block memory pool and copies the data */
557 extern
559  BMS_BLKMEM* blkmem, /**< block memory */
560  const void* source, /**< memory element to duplicate */
561  size_t size, /**< size of memory elements */
562  const char* filename, /**< source file of the function call */
563  int line /**< line number in source file of the function call */
564  );
565 
566 /** duplicates array in the block memory pool and copies the data */
567 extern
569  BMS_BLKMEM* blkmem, /**< block memory */
570  const void* source, /**< memory element to duplicate */
571  size_t num, /**< size of array to be duplicated */
572  size_t typesize, /**< size of each component */
573  const char* filename, /**< source file of the function call */
574  int line /**< line number in source file of the function call */
575  );
576 
577 /** frees memory element in the block memory pool and sets pointer to NULL */
578 extern
580  BMS_BLKMEM* blkmem, /**< block memory */
581  void** ptr, /**< pointer to pointer to memory element to free */
582  size_t size, /**< size of memory element */
583  const char* filename, /**< source file of the function call */
584  int line /**< line number in source file of the function call */
585  );
586 
587 /** frees memory element in the block memory pool if pointer is not NULL and sets pointer to NULL */
588 extern
590  BMS_BLKMEM* blkmem, /**< block memory */
591  void** ptr, /**< pointer to pointer to memory element to free */
592  size_t size, /**< size of memory element */
593  const char* filename, /**< source file of the function call */
594  int line /**< line number in source file of the function call */
595  );
596 
597 /** calls garbage collection of block memory, frees chunks without allocated memory elements, and frees
598  * chunk blocks without any chunks
599  */
600 extern
602  BMS_BLKMEM* blkmem /**< block memory */
603  );
604 
605 /** returns the number of allocated bytes in the block memory */
606 extern
608  const BMS_BLKMEM* blkmem /**< block memory */
609  );
610 
611 /** returns the number of used bytes in the block memory */
612 extern
614  const BMS_BLKMEM* blkmem /**< block memory */
615  );
616 
617 /** returns the number of allocated but not used bytes in the block memory */
618 extern
620  const BMS_BLKMEM* blkmem /**< block memory */
621  );
622 
623 /** returns the maximal number of used bytes in the block memory */
624 extern
626  const BMS_BLKMEM* blkmem /**< block memory */
627  );
628 
629 /** returns the maximal number of allocated but not used bytes in the block memory */
630 extern
632  const BMS_BLKMEM* blkmem /**< block memory */
633  );
634 
635 /** returns the maximal number of allocated bytes in the block memory */
637  const BMS_BLKMEM* blkmem /**< block memory */
638  );
639 
640 /** returns the size of the given memory element; returns 0, if the element is not member of the block memory */
641 extern
643  const BMS_BLKMEM* blkmem, /**< block memory */
644  const void* ptr /**< memory element */
645  );
646 
647 /** outputs allocation diagnostics of block memory */
648 extern
650  const BMS_BLKMEM* blkmem /**< block memory */
651  );
652 
653 /** outputs error messages, if there are allocated elements in the block memory and returns number of unfreed bytes */
654 extern
656  const BMS_BLKMEM* blkmem /**< block memory */
657  );
658 
659 
660 
661 
662 
663 /***********************************************************
664  * Buffer Memory Management
665  *
666  * Efficient memory management for temporary objects
667  ***********************************************************/
668 
669 typedef struct BMS_BufMem BMS_BUFMEM; /**< buffer memory for temporary objects */
670 
671 /* Note: values that are passed as a size_t parameter are first converted to ptrdiff_t to be sure that negative numbers
672  * are extended to the larger size. Then they are converted to size_t. Thus, negative numbers are converted to very
673  * large size_t values. This is then checked within the functions. */
674 
675 #define BMSallocBufferMemory(mem,ptr) ASSIGN((ptr), BMSallocBufferMemory_call((mem), sizeof(**(ptr)), __FILE__, __LINE__))
676 #define BMSallocBufferMemorySize(mem,ptr,size) ASSIGN((ptr), BMSallocBufferMemory_call((mem), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__))
677 #define BMSreallocBufferMemorySize(mem,ptr,size) \
678  ASSIGN((ptr), BMSreallocBufferMemory_call((mem), (void*)(*(ptr)), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__))
679 #define BMSallocBufferMemoryArray(mem,ptr,num) ASSIGN((ptr), BMSallocBufferMemoryArray_call((mem), (size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__))
680 #define BMSallocClearBufferMemoryArray(mem,ptr,num) ASSIGN((ptr), BMSallocClearBufferMemoryArray_call((mem), (size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__))
681 #define BMSreallocBufferMemoryArray(mem,ptr,num) ASSIGN((ptr), BMSreallocBufferMemoryArray_call((mem), (void*)(*(ptr)), (size_t)(ptrdiff_t)(num), \
682  sizeof(**(ptr)), __FILE__, __LINE__))
683 #define BMSduplicateBufferMemory(mem,ptr,source,size) \
684  ASSIGN((ptr), BMSduplicateBufferMemory_call((mem), (const void*)(source), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__))
685 #define BMSduplicateBufferMemoryArray(mem,ptr,source,num) ASSIGN((ptr), BMSduplicateBufferMemoryArray_call((mem), \
686  (const void*)(source), (size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__))
687 
688 #define BMSfreeBufferMemory(mem,ptr) BMSfreeBufferMemory_call((mem), (void**)(ptr), __FILE__, __LINE__)
689 #define BMSfreeBufferMemoryNull(mem,ptr) BMSfreeBufferMemoryNull_call((mem), (void**)(ptr), __FILE__, __LINE__)
690 #define BMSfreeBufferMemoryArray(mem,ptr) BMSfreeBufferMemory_call((mem), (void**)(ptr), __FILE__, __LINE__)
691 #define BMSfreeBufferMemoryArrayNull(mem,ptr) BMSfreeBufferMemoryNull_call((mem), (void**)(ptr), __FILE__, __LINE__)
692 #define BMSfreeBufferMemorySize(mem,ptr) BMSfreeBufferMemory_call((mem), (void**)(ptr), __FILE__, __LINE__);
693 #define BMSfreeBufferMemorySizeNull(mem,ptr) BMSfreeBufferMemoryNull_call((mem), (void**)(ptr), __FILE__, __LINE__)
694 
695 #define BMScreateBufferMemory(fac,init,clean) BMScreateBufferMemory_call((fac), (init), (clean), __FILE__, __LINE__)
696 #define BMSdestroyBufferMemory(mem) BMSdestroyBufferMemory_call((mem), __FILE__, __LINE__)
697 
698 
699 /** creates memory buffer storage */
700 extern
702  double arraygrowfac, /**< memory growing factor for dynamically allocated arrays */
703  int arraygrowinit, /**< initial size of dynamically allocated arrays */
704  unsigned int clean, /**< should the memory blocks in the buffer be initialized to zero? */
705  const char* filename, /**< source file of the function call */
706  int line /**< line number in source file of the function call */
707  );
708 
709 /** destroys buffer memory */
710 extern
712  BMS_BUFMEM** buffer, /**< pointer to memory buffer storage */
713  const char* filename, /**< source file of the function call */
714  int line /**< line number in source file of the function call */
715  );
716 
717 /** set arraygrowfac */
718 extern
720  BMS_BUFMEM* buffer, /**< pointer to memory buffer storage */
721  double arraygrowfac /**< memory growing factor for dynamically allocated arrays */
722  );
723 
724 /** set arraygrowinit */
725 extern
727  BMS_BUFMEM* buffer, /**< pointer to memory buffer storage */
728  int arraygrowinit /**< initial size of dynamically allocated arrays */
729  );
730 
731 /** allocates the next unused buffer */
732 extern
734  BMS_BUFMEM* buffer, /**< memory buffer storage */
735  size_t size, /**< minimal required size of the buffer */
736  const char* filename, /**< source file of the function call */
737  int line /**< line number in source file of the function call */
738  );
739 
740 /** allocates the next unused buffer array */
741 extern
743  BMS_BUFMEM* buffer, /**< memory buffer storage */
744  size_t num, /**< size of array to be allocated */
745  size_t typesize, /**< size of components */
746  const char* filename, /**< source file of the function call */
747  int line /**< line number in source file of the function call */
748  );
749 
750 /** allocates the next unused buffer and clears it */
751 extern
753  BMS_BUFMEM* buffer, /**< memory buffer storage */
754  size_t num, /**< size of array to be allocated */
755  size_t typesize, /**< size of components */
756  const char* filename, /**< source file of the function call */
757  int line /**< line number in source file of the function call */
758  );
759 
760 /** reallocates the buffer to at least the given size */
761 extern
763  BMS_BUFMEM* buffer, /**< memory buffer storage */
764  void* ptr, /**< pointer to the allocated memory buffer */
765  size_t size, /**< minimal required size of the buffer */
766  const char* filename, /**< source file of the function call */
767  int line /**< line number in source file of the function call */
768  );
769 
770 /** reallocates an array in the buffer to at least the given size */
771 extern
773  BMS_BUFMEM* buffer, /**< memory buffer storage */
774  void* ptr, /**< pointer to the allocated memory buffer */
775  size_t num, /**< size of array to be allocated */
776  size_t typesize, /**< size of components */
777  const char* filename, /**< source file of the function call */
778  int line /**< line number in source file of the function call */
779  );
780 
781 /** allocates the next unused buffer and copies the given memory into the buffer */
782 extern
784  BMS_BUFMEM* buffer, /**< memory buffer storage */
785  const void* source, /**< memory block to copy into the buffer */
786  size_t size, /**< minimal required size of the buffer */
787  const char* filename, /**< source file of the function call */
788  int line /**< line number in source file of the function call */
789  );
790 
791 /** allocates an array in the next unused buffer and copies the given memory into the buffer */
792 extern
794  BMS_BUFMEM* buffer, /**< memory buffer storage */
795  const void* source, /**< memory block to copy into the buffer */
796  size_t num, /**< size of array to be allocated */
797  size_t typesize, /**< size of components */
798  const char* filename, /**< source file of the function call */
799  int line /**< line number in source file of the function call */
800  );
801 
802 /** frees a buffer and sets pointer to NULL */
803 extern
805  BMS_BUFMEM* buffer, /**< memory buffer storage */
806  void** ptr, /**< pointer to pointer to the allocated memory buffer */
807  const char* filename, /**< source file of the function call */
808  int line /**< line number in source file of the function call */
809  );
810 
811 /** frees a buffer if pointer is not NULL and sets pointer to NULL */
812 extern
814  BMS_BUFMEM* buffer, /**< memory buffer storage */
815  void** ptr, /**< pointer to pointer to the allocated memory buffer */
816  const char* filename, /**< source file of the function call */
817  int line /**< line number in source file of the function call */
818  );
819 
820 /** gets number of used buffers */
821 extern
823  BMS_BUFMEM* buffer /**< memory buffer storage */
824  );
825 
826 /** returns the number of allocated bytes in the buffer memory */
827 extern
828 long long BMSgetBufferMemoryUsed(
829  const BMS_BUFMEM* bufmem /**< buffer memory */
830  );
831 
832 /** outputs statistics about currently allocated buffers to the screen */
833 extern
835  BMS_BUFMEM* buffer /**< memory buffer storage */
836  );
837 
838 
839 #ifdef __cplusplus
840 }
841 #endif
842 
843 #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:261
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:396
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