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 #ifdef __cplusplus
33 
34 
35 /* special thanks to Daniel Junglas for following template and macros */
36 
37 template<typename T> T* docast(T*, void *v);
38 template<typename T> T* docast(T*, void *v) { return reinterpret_cast<T*>(v); }
39 
40 /* For C++11, we can easily check whether the types for memory functions like BMSduplicateXYZArray() are equal. */
41 #if __cplusplus > 199711L
42 #include <type_traits>
43 
44 /* the following adds a type check for the parameters, used in ASSIGNCHECK below */
45 template<typename T1, typename T2> T1* docastcheck(T1* v1, void* v, T2* v2)
46 {
47  typedef typename std::remove_const<T1>::type t1;
48  typedef typename std::remove_const<T2>::type t2;
49  static_assert(std::is_same<t1, t2>(), "need equal types");
50  return reinterpret_cast<T1*>(v);
51 }
52 #else
53 /* for older compilers do nothing */
54 template<typename T1, typename T2> T1* docastcheck(T1* v1, void* v, T2* v2) { return reinterpret_cast<T1*>(v); }
55 #endif
56 
57 
58 extern "C" {
59 
60 #define ASSIGN(pointerstarstar, voidstarfunction) (*(pointerstarstar) = docast(*(pointerstarstar), (voidstarfunction)))
61 #define ASSIGNCHECK(pointerstarstar, voidstarfunction, origpointer) (*(pointerstarstar) = docastcheck(*(pointerstarstar), (voidstarfunction), (origpointer)))
62 
63 #else
64 
65 #define ASSIGN(pointerstarstar, voidstarfunction) (*(pointerstarstar) = (voidstarfunction))
66 #define ASSIGNCHECK(pointerstarstar, voidstarfunction, origpointer) (*(pointerstarstar) = (voidstarfunction))
67 
68 #endif
69 
70 /*
71  * Define the macro EXTERN depending if the OS is Windows or not
72  */
73 #ifndef EXTERN
74 
75 #if defined(_WIN32) || defined(_WIN64)
76 #define EXTERN __declspec(dllexport)
77 #else
78 #define EXTERN extern
79 #endif
80 
81 #endif
82 
83 /* define if not already existing to make file independent from def.h */
84 #ifndef SCIP_UNUSED
85 #define SCIP_UNUSED(x) ((void) (x))
86 #endif
87 
88 
89 /*************************************************************************************
90  * Standard Memory Management
91  *
92  * In debug mode, these methods extend malloc() and free() by logging all currently
93  * allocated memory elements in an allocation list. This can be used as a simple leak
94  * detection.
95  *************************************************************************************/
96 
97 /* Note: values that are passed as a size_t parameter are first converted to ptrdiff_t to be sure that negative numbers
98  * are extended to the larger size. Then they are converted to size_t. Thus, negative numbers are converted to very
99  * large size_t values. This is then checked within the functions. */
100 
101 #define BMSallocMemory(ptr) ASSIGN((ptr), BMSallocMemory_call( sizeof(**(ptr)), __FILE__, __LINE__ ))
102 #define BMSallocMemorySize(ptr,size) ASSIGN((ptr), BMSallocMemory_call( (size_t)(ptrdiff_t)(size), __FILE__, __LINE__ ))
103 #define BMSallocMemoryCPP(size) BMSallocMemory_call( (size_t)(ptrdiff_t)(size), __FILE__, __LINE__ )
104 #define BMSallocClearMemorySize(ptr,size) ASSIGN((ptr), BMSallocClearMemory_call((size_t)(1), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__ ))
105 #define BMSallocMemoryArray(ptr,num) ASSIGN((ptr), BMSallocMemoryArray_call((size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__ ))
106 #define BMSallocMemoryArrayCPP(num,size) BMSallocMemoryArray_call( (size_t)(ptrdiff_t)(num), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__ )
107 #define BMSallocClearMemoryArray(ptr,num) ASSIGN((ptr), BMSallocClearMemory_call((size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__ ))
108 #define BMSreallocMemorySize(ptr,size) ASSIGN((ptr), BMSreallocMemory_call((void*)(*(ptr)), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__ ))
109 #define BMSreallocMemoryArray(ptr,num) ASSIGN((ptr), BMSreallocMemoryArray_call( *(ptr), (size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__ ))
110 
111 #define BMSclearMemory(ptr) BMSclearMemory_call( (void*)(ptr), sizeof(*(ptr)) )
112 #define BMSclearMemoryArray(ptr, num) BMSclearMemory_call( (void*)(ptr), (size_t)(ptrdiff_t)(num)*sizeof(*(ptr)) )
113 #define BMSclearMemorySize(ptr, size) BMSclearMemory_call( (void*)(ptr), (size_t)(ptrdiff_t)(size) )
114 
115 #define BMScopyMemory(ptr, source) BMScopyMemory_call( (void*)(ptr), (const void*)(source), sizeof(*(ptr)) )
116 #define BMScopyMemoryArray(ptr, source, num) BMScopyMemory_call( (void*)(ptr), (const void*)(source), (size_t)(ptrdiff_t)(num)*sizeof(*(ptr)) )
117 #define BMScopyMemorySize(ptr, source, size) BMScopyMemory_call( (void*)(ptr), (const void*)(source), (size_t)(ptrdiff_t)(size) )
118 
119 #define BMSmoveMemory(ptr, source) BMSmoveMemory_call( (void*)(ptr), (const void*)(source), sizeof(*(ptr)) )
120 #define BMSmoveMemoryArray(ptr, source, num) BMSmoveMemory_call( (void*)(ptr), (const void*)(source), (size_t)(ptrdiff_t)(num) * sizeof(*(ptr)) )
121 #define BMSmoveMemorySize(ptr, source, size) BMSmoveMemory_call( (void*)(ptr), (const void*)(source), (size_t)(ptrdiff_t)(size) )
122 
123 #define BMSduplicateMemory(ptr, source) ASSIGN((ptr), BMSduplicateMemory_call( (const void*)(source), sizeof(**(ptr)), __FILE__, __LINE__ ))
124 #define BMSduplicateMemorySize(ptr, source, size) ASSIGN((ptr), BMSduplicateMemory_call( (const void*)(source), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__ ))
125 #define BMSduplicateMemoryArray(ptr, source, num) ASSIGNCHECK((ptr), BMSduplicateMemoryArray_call( (const void*)(source), (size_t)(ptrdiff_t)(num), \
126  sizeof(**(ptr)), __FILE__, __LINE__ ), source)
127 #define BMSfreeMemory(ptr) BMSfreeMemory_call( (void**)(ptr), __FILE__, __LINE__ )
128 #define BMSfreeMemoryNull(ptr) BMSfreeMemoryNull_call( (void**)(ptr), __FILE__, __LINE__ )
129 #define BMSfreeMemoryArray(ptr) BMSfreeMemory_call( (void**)(ptr), __FILE__, __LINE__ )
130 #define BMSfreeMemoryArrayNull(ptr) BMSfreeMemoryNull_call( (void**)(ptr), __FILE__, __LINE__ )
131 #define BMSfreeMemorySize(ptr) BMSfreeMemory_call( (void**)(ptr), __FILE__, __LINE__ )
132 #define BMSfreeMemorySizeNull(ptr) BMSfreeMemoryNull_call( (void**)(ptr), __FILE__, __LINE__ )
133 
134 #ifndef NDEBUG
135 #define BMSgetPointerSize(ptr) BMSgetPointerSize_call(ptr)
136 #define BMSdisplayMemory() BMSdisplayMemory_call()
137 #define BMScheckEmptyMemory() BMScheckEmptyMemory_call()
138 #define BMSgetMemoryUsed() BMSgetMemoryUsed_call()
139 #else
140 #define BMSgetPointerSize(ptr) 0
141 #define BMSdisplayMemory() /**/
142 #define BMScheckEmptyMemory() /**/
143 #define BMSgetMemoryUsed() 0LL
144 #endif
145 
146 /** allocates array and initializes it with 0; returns NULL if memory allocation failed */
147 extern
149  size_t num, /**< number of memory element to allocate */
150  size_t typesize, /**< size of memory element to allocate */
151  const char* filename, /**< source file where the allocation is performed */
152  int line /**< line number in source file where the allocation is performed */
153  );
154 
155 /** allocates memory; returns NULL if memory allocation failed */
156 extern
157 void* BMSallocMemory_call(
158  size_t size, /**< size of memory element to allocate */
159  const char* filename, /**< source file where the allocation is performed */
160  int line /**< line number in source file where the allocation is performed */
161  );
162 
163 /** allocates array; returns NULL if memory allocation failed */
164 extern
166  size_t num, /**< number of components of array to allocate */
167  size_t typesize, /**< size of each component */
168  const char* filename, /**< source file where the allocation is performed */
169  int line /**< line number in source file where the allocation is performed */
170  );
171 
172 /** allocates memory; returns NULL if memory allocation failed */
173 extern
175  void* ptr, /**< pointer to memory to reallocate */
176  size_t size, /**< new size of memory element */
177  const char* filename, /**< source file where the reallocation is performed */
178  int line /**< line number in source file where the reallocation is performed */
179  );
180 
181 /** reallocates array; returns NULL if memory allocation failed */
182 extern
184  void* ptr, /**< pointer to memory to reallocate */
185  size_t num, /**< number of components of array to allocate */
186  size_t typesize, /**< size of each component */
187  const char* filename, /**< source file where the reallocation is performed */
188  int line /**< line number in source file where the reallocation is performed */
189  );
190 
191 /** clears a memory element (i.e. fills it with zeros) */
192 extern
194  void* ptr, /**< pointer to memory element */
195  size_t size /**< size of memory element */
196  );
197 
198 /** copies the contents of one memory element into another memory element */
199 extern
200 void BMScopyMemory_call(
201  void* ptr, /**< pointer to target memory element */
202  const void* source, /**< pointer to source memory element */
203  size_t size /**< size of memory element to copy */
204  );
205 
206 /** moves the contents of one memory element into another memory element, should be used if both elements overlap,
207  * otherwise BMScopyMemory is faster
208  */
209 extern
210 void BMSmoveMemory_call(
211  void* ptr, /**< pointer to target memory element */
212  const void* source, /**< pointer to source memory element */
213  size_t size /**< size of memory element to copy */
214  );
215 
216 /** allocates memory and copies the contents of the given memory element into the new memory element */
217 extern
219  const void* source, /**< pointer to source memory element */
220  size_t size, /**< size of memory element to copy */
221  const char* filename, /**< source file where the duplication is performed */
222  int line /**< line number in source file where the duplication is performed */
223  );
224 
225 /** allocates array and copies the contents of the given source array into the new array */
226 extern
228  const void* source, /**< pointer to source memory element */
229  size_t num, /**< number of components of array to allocate */
230  size_t typesize, /**< size of each component */
231  const char* filename, /**< source file where the duplication is performed */
232  int line /**< line number in source file where the duplication is performed */
233  );
234 
235 /** frees an allocated memory element and sets pointer to NULL */
236 extern
237 void BMSfreeMemory_call(
238  void** ptr, /**< pointer to pointer to memory element */
239  const char* filename, /**< source file where the deallocation is performed */
240  int line /**< line number in source file where the deallocation is performed */
241  );
242 
243 /** frees an allocated memory element if pointer is not NULL and sets pointer to NULL */
244 extern
246  void** ptr, /**< pointer to pointer to memory element */
247  const char* filename, /**< source file where the deallocation is performed */
248  int line /**< line number in source file where the deallocation is performed */
249  );
250 
251 /** returns the size of an allocated memory element */
252 extern
254  const void* ptr /**< pointer to allocated memory */
255  );
256 
257 /** outputs information about currently allocated memory to the screen */
258 extern
260  void
261  );
262 
263 /** displays a warning message on the screen, if allocated memory exists */
264 extern
266  void
267  );
268 
269 /** returns total number of allocated bytes */
270 extern
271 long long BMSgetMemoryUsed_call(
272  void
273  );
274 
275 
276 
277 
278 /********************************************************************
279  * Chunk Memory Management
280  *
281  * Efficient memory management for multiple objects of the same size
282  ********************************************************************/
283 
284 typedef struct BMS_ChkMem BMS_CHKMEM; /**< collection of memory chunks of the same element size */
285 
286 
287 #ifndef BMS_NOBLOCKMEM
288 
289 #define BMScreateChunkMemory(sz,isz,gbf) BMScreateChunkMemory_call( (sz), (isz), (gbf), __FILE__, __LINE__ )
290 #define BMSclearChunkMemory(mem) BMSclearChunkMemory_call( (mem), __FILE__, __LINE__ )
291 #define BMSdestroyChunkMemory(mem) BMSdestroyChunkMemory_call( (mem), __FILE__, __LINE__ )
292 
293 #define BMSallocChunkMemory(mem,ptr) ASSIGN((ptr), BMSallocChunkMemory_call((mem), sizeof(**(ptr)), __FILE__, __LINE__))
294 #define BMSduplicateChunkMemory(mem, ptr, source) ASSIGN((ptr), BMSduplicateChunkMemory_call((mem), (const void*)(source), \
295  sizeof(**(ptr)), __FILE__, __LINE__ ))
296 #define BMSfreeChunkMemory(mem,ptr) BMSfreeChunkMemory_call( (mem), (void**)(ptr), sizeof(**(ptr)), __FILE__, __LINE__ )
297 #define BMSfreeChunkMemoryNull(mem,ptr) BMSfreeChunkMemoryNull_call( (mem), (void**)(ptr) )
298 #define BMSgarbagecollectChunkMemory(mem) BMSgarbagecollectChunkMemory_call(mem)
299 #define BMSgetChunkMemoryUsed(mem) BMSgetChunkMemoryUsed_call(mem)
300 
301 #else
302 
303 /* block memory management mapped to standard memory management */
304 
305 #define BMScreateChunkMemory(sz,isz,gbf) (void*)(0x01) /* dummy to not return a NULL pointer */
306 #define BMSclearChunkMemory(mem) /**/
307 #define BMSclearChunkMemoryNull(mem) /**/
308 #define BMSdestroyChunkMemory(mem) /**/
309 #define BMSdestroyChunkMemoryNull(mem) /**/
310 #define BMSallocChunkMemory(mem,ptr) BMSallocMemory(ptr)
311 #define BMSduplicateChunkMemory(mem, ptr, source) BMSduplicateMemory(ptr,source)
312 #define BMSfreeChunkMemory(mem,ptr) BMSfreeMemory(ptr)
313 #define BMSfreeChunkMemoryNull(mem,ptr) BMSfreeMemoryNull(ptr)
314 #define BMSgarbagecollectChunkMemory(mem) /**/
315 #define BMSgetChunkMemoryUsed(mem) 0LL
316 
317 #endif
318 
319 
320 /** aligns the given byte size corresponding to the minimal alignment for chunk and block memory */
321 extern
322 void BMSalignMemsize(
323  size_t* size /**< pointer to the size to align */
324  );
325 
326 /** checks whether the given size meets the alignment conditions for chunk and block memory */
327 extern
328 int BMSisAligned(
329  size_t size /**< size to check for alignment */
330  );
331 
332 /** creates a new chunk block data structure */
333 extern
335  size_t size, /**< element size of the chunk block */
336  int initchunksize, /**< number of elements in the first chunk of the chunk block */
337  int garbagefactor, /**< garbage collector is called, if at least garbagefactor * avg. chunksize
338  * elements are free (-1: disable garbage collection) */
339  const char* filename, /**< source file of the function call */
340  int line /**< line number in source file of the function call */
341  );
342 
343 /** clears a chunk block data structure */
344 extern
346  BMS_CHKMEM* chkmem, /**< chunk block */
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 /** destroys and frees a chunk block data structure */
352 extern
354  BMS_CHKMEM** chkmem, /**< pointer to chunk block */
355  const char* filename, /**< source file of the function call */
356  int line /**< line number in source file of the function call */
357  );
358 
359 /** allocates a memory element of the given chunk block */
360 extern
362  BMS_CHKMEM* chkmem, /**< chunk block */
363  size_t size, /**< size of memory element to allocate (only needed for sanity check) */
364  const char* filename, /**< source file of the function call */
365  int line /**< line number in source file of the function call */
366  );
367 
368 /** duplicates a given memory element by allocating a new element of the same chunk block and copying the data */
369 extern
371  BMS_CHKMEM* chkmem, /**< chunk block */
372  const void* source, /**< source memory element */
373  size_t size, /**< size of memory element to allocate (only needed for sanity check) */
374  const char* filename, /**< source file of the function call */
375  int line /**< line number in source file of the function call */
376  );
377 
378 /** frees a memory element of the given chunk block and sets pointer to NULL */
379 extern
381  BMS_CHKMEM* chkmem, /**< chunk block */
382  void** ptr, /**< pointer to pointer to memory element to free */
383  size_t size, /**< size of memory element to allocate (only needed for sanity check) */
384  const char* filename, /**< source file of the function call */
385  int line /**< line number in source file of the function call */
386  );
387 
388 /** frees a memory element of the given chunk block if pointer is not NULL and sets pointer to NULL */
389 extern
391  BMS_CHKMEM* chkmem, /**< chunk block */
392  void** ptr, /**< pointer to pointer to memory element to free */
393  size_t size, /**< size of memory element to allocate (only needed for sanity check) */
394  const char* filename, /**< source file of the function call */
395  int line /**< line number in source file of the function call */
396  );
397 
398 /** calls garbage collection of chunk block and frees chunks without allocated memory elements */
399 extern
401  BMS_CHKMEM* chkmem /**< chunk block */
402  );
403 
404 /** returns the number of allocated bytes in the chunk block */
405 extern
407  const BMS_CHKMEM* chkmem /**< chunk block */
408  );
409 
410 
411 
412 
413 /***********************************************************
414  * Block Memory Management
415  *
416  * Efficient memory management for objects of varying sizes
417  ***********************************************************/
418 
419 typedef struct BMS_BlkMem BMS_BLKMEM; /**< block memory: collection of chunk blocks */
420 
421 #ifndef BMS_NOBLOCKMEM
422 
423 /* block memory methods for faster memory access */
424 
425 /* Note: values that are passed as a size_t parameter are first converted to ptrdiff_t to be sure that negative numbers
426  * are extended to the larger size. Then they are converted to size_t. Thus, negative numbers are converted to very
427  * large size_t values. This is then checked within the functions. */
428 
429 #define BMScreateBlockMemory(csz,gbf) BMScreateBlockMemory_call( (csz), (gbf), __FILE__, __LINE__ )
430 #define BMSclearBlockMemory(mem) BMSclearBlockMemory_call( (mem), __FILE__, __LINE__ )
431 #define BMSdestroyBlockMemory(mem) BMSdestroyBlockMemory_call( (mem), __FILE__, __LINE__ )
432 
433 #define BMSallocBlockMemory(mem,ptr) ASSIGN((ptr), BMSallocBlockMemory_call((mem), sizeof(**(ptr)), __FILE__, __LINE__))
434 #define BMSallocBlockMemorySize(mem,ptr,size) ASSIGN((ptr), BMSallocBlockMemory_call((mem), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__))
435 #define BMSallocBlockMemoryArray(mem,ptr,num) ASSIGN((ptr), BMSallocBlockMemoryArray_call((mem), (size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__))
436 #define BMSallocClearBlockMemoryArray(mem,ptr,num) ASSIGN((ptr), BMSallocClearBlockMemoryArray_call((mem), (size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__))
437 #define BMSreallocBlockMemorySize(mem,ptr,oldsize,newsize) ASSIGN((ptr), BMSreallocBlockMemory_call((mem), (void*)(*(ptr)), \
438  (size_t)(ptrdiff_t)(oldsize), (size_t)(ptrdiff_t)(newsize), __FILE__, __LINE__))
439 #define BMSreallocBlockMemoryArray(mem,ptr,oldnum,newnum) ASSIGN((ptr), BMSreallocBlockMemoryArray_call((mem), (void*)(*(ptr)), \
440  (size_t)(ptrdiff_t)(oldnum), (size_t)(ptrdiff_t)(newnum), sizeof(**(ptr)), __FILE__, __LINE__))
441 #define BMSduplicateBlockMemory(mem, ptr, source) ASSIGN((ptr), BMSduplicateBlockMemory_call((mem), (const void*)(source), \
442  sizeof(**(ptr)), __FILE__, __LINE__ ))
443 #define BMSduplicateBlockMemoryArray(mem, ptr, source, num) ASSIGNCHECK((ptr), BMSduplicateBlockMemoryArray_call( (mem), (const void*)(source), \
444  (size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__ ), source)
445 
446 #define BMSfreeBlockMemory(mem,ptr) BMSfreeBlockMemory_call( (mem), (void**)(ptr), sizeof(**(ptr)), __FILE__, __LINE__ )
447 #define BMSfreeBlockMemoryNull(mem,ptr) BMSfreeBlockMemoryNull_call( (mem), (void**)(ptr), sizeof(**(ptr)), __FILE__, __LINE__ )
448 #define BMSfreeBlockMemoryArray(mem,ptr,num) BMSfreeBlockMemory_call( (mem), (void**)(ptr), (num)*sizeof(**(ptr)), __FILE__, __LINE__ )
449 #define BMSfreeBlockMemoryArrayNull(mem,ptr,num) BMSfreeBlockMemoryNull_call( (mem), (void**)(ptr), (num)*sizeof(**(ptr)), __FILE__, __LINE__ )
450 #define BMSfreeBlockMemorySize(mem,ptr,size) BMSfreeBlockMemory_call( (mem), (void**)(ptr), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__ )
451 #define BMSfreeBlockMemorySizeNull(mem,ptr,size) BMSfreeBlockMemory_call( (mem), (void**)(ptr), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__ )
452 
453 #define BMSgarbagecollectBlockMemory(mem) BMSgarbagecollectBlockMemory_call(mem)
454 #define BMSgetBlockMemoryAllocated(mem) BMSgetBlockMemoryAllocated_call(mem)
455 #define BMSgetBlockMemoryUsed(mem) BMSgetBlockMemoryUsed_call(mem)
456 #define BMSgetBlockMemoryUnused(mem) BMSgetBlockMemoryUnused_call(mem)
457 #define BMSgetBlockMemoryUsedMax(mem) BMSgetBlockMemoryUsedMax_call(mem)
458 #define BMSgetBlockMemoryUnusedMax(mem) BMSgetBlockMemoryUnusedMax_call(mem)
459 #define BMSgetBlockMemoryAllocatedMax(mem) BMSgetBlockMemoryAllocatedMax_call(mem)
460 #define BMSgetBlockPointerSize(mem,ptr) BMSgetBlockPointerSize_call((mem), (ptr))
461 #define BMSdisplayBlockMemory(mem) BMSdisplayBlockMemory_call(mem)
462 #define BMSblockMemoryCheckEmpty(mem) BMScheckEmptyBlockMemory_call(mem)
463 
464 #else
465 
466 /* block memory management mapped to standard memory management */
467 
468 #define BMScreateBlockMemory(csz,gbf) (SCIP_UNUSED(csz), SCIP_UNUSED(gbf), (void*)(0x01)) /* dummy to not return a NULL pointer */
469 #define BMSclearBlockMemory(mem) SCIP_UNUSED(mem)
470 #define BMSclearBlockMemoryNull(mem) SCIP_UNUSED(mem)
471 #define BMSdestroyBlockMemory(mem) SCIP_UNUSED(mem)
472 #define BMSdestroyBlockMemoryNull(mem) SCIP_UNUSED(mem)
473 #define BMSallocBlockMemory(mem,ptr) (SCIP_UNUSED(mem), BMSallocMemory(ptr))
474 #define BMSallocBlockMemoryArray(mem,ptr,num) (SCIP_UNUSED(mem), BMSallocMemoryArray(ptr,num))
475 #define BMSallocClearBlockMemoryArray(mem,ptr,num) (SCIP_UNUSED(mem), BMSallocClearMemoryArray(ptr,num))
476 #define BMSallocBlockMemorySize(mem,ptr,size) (SCIP_UNUSED(mem), BMSallocMemorySize(ptr,size))
477 #define BMSreallocBlockMemoryArray(mem,ptr,oldnum,newnum) (SCIP_UNUSED(mem), SCIP_UNUSED(oldnum), BMSreallocMemoryArray(ptr,newnum))
478 #define BMSreallocBlockMemorySize(mem,ptr,oldsize,newsize) (SCIP_UNUSED(mem), SCIP_UNUSED(oldsize), BMSreallocMemorySize(ptr,newsize))
479 #define BMSduplicateBlockMemory(mem, ptr, source) (SCIP_UNUSED(mem), BMSduplicateMemory(ptr,source))
480 #define BMSduplicateBlockMemoryArray(mem, ptr, source, num) (SCIP_UNUSED(mem), BMSduplicateMemoryArray(ptr,source,num))
481 #define BMSfreeBlockMemory(mem,ptr) (SCIP_UNUSED(mem), BMSfreeMemory(ptr))
482 #define BMSfreeBlockMemoryNull(mem,ptr) (SCIP_UNUSED(mem), BMSfreeMemoryNull(ptr))
483 #define BMSfreeBlockMemoryArray(mem,ptr,num) (SCIP_UNUSED(mem), SCIP_UNUSED(num), BMSfreeMemoryArray(ptr))
484 #define BMSfreeBlockMemoryArrayNull(mem,ptr,num) (SCIP_UNUSED(mem), SCIP_UNUSED(num), BMSfreeMemoryArrayNull(ptr))
485 #define BMSfreeBlockMemorySize(mem,ptr,size) (SCIP_UNUSED(mem), SCIP_UNUSED(size), BMSfreeMemory(ptr))
486 #define BMSfreeBlockMemorySizeNull(mem,ptr,size) (SCIP_UNUSED(mem), SCIP_UNUSED(size), BMSfreeMemoryNull(ptr))
487 #define BMSgarbagecollectBlockMemory(mem) SCIP_UNUSED(mem)
488 #define BMSgetBlockMemoryAllocated(mem) (SCIP_UNUSED(mem), 0LL)
489 #define BMSgetBlockMemoryUsed(mem) (SCIP_UNUSED(mem), 0LL)
490 #define BMSgetBlockMemoryUnused(mem) (SCIP_UNUSED(mem), 0LL)
491 #define BMSgetBlockMemoryUsedMax(mem) (SCIP_UNUSED(mem), 0LL)
492 #define BMSgetBlockMemoryUnusedMax(mem) (SCIP_UNUSED(mem), 0LL)
493 #define BMSgetBlockMemoryAllocatedMax(mem) (SCIP_UNUSED(mem), 0LL)
494 #define BMSgetBlockPointerSize(mem,ptr) (SCIP_UNUSED(mem), SCIP_UNUSED(ptr), 0)
495 #define BMSdisplayBlockMemory(mem) SCIP_UNUSED(mem)
496 #define BMSblockMemoryCheckEmpty(mem) (SCIP_UNUSED(mem), 0LL)
497 
498 #endif
499 
500 
501 /** creates a block memory allocation data structure */
502 extern
504  int initchunksize, /**< number of elements in the first chunk of each chunk block */
505  int garbagefactor, /**< garbage collector is called, if at least garbagefactor * avg. chunksize
506  * elements are free (-1: disable garbage collection) */
507  const char* filename, /**< source file of the function call */
508  int line /**< line number in source file of the function call */
509  );
510 
511 /** frees all chunk blocks in the block memory */
512 extern
514  BMS_BLKMEM* blkmem, /**< block memory */
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 /** clears and deletes block memory */
520 extern
522  BMS_BLKMEM** blkmem, /**< pointer to block memory */
523  const char* filename, /**< source file of the function call */
524  int line /**< line number in source file of the function call */
525  );
526 
527 /** allocates memory in the block memory pool */
528 extern
530  BMS_BLKMEM* blkmem, /**< block memory */
531  size_t size, /**< size of memory element to allocate */
532  const char* filename, /**< source file of the function call */
533  int line /**< line number in source file of the function call */
534  );
535 
536 /** allocates array in the block memory pool */
537 extern
539  BMS_BLKMEM* blkmem, /**< block memory */
540  size_t num, /**< size of array to be allocated */
541  size_t typesize, /**< size of each component */
542  const char* filename, /**< source file of the function call */
543  int line /**< line number in source file of the function call */
544  );
545 
546 /** allocates array in the block memory pool and clears it */
547 extern
549  BMS_BLKMEM* blkmem, /**< block memory */
550  size_t num, /**< size of array to be allocated */
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 /** resizes memory element in the block memory pool and copies the data */
557 extern
559  BMS_BLKMEM* blkmem, /**< block memory */
560  void* ptr, /**< memory element to reallocated */
561  size_t oldsize, /**< old size of memory element */
562  size_t newsize, /**< new size of memory element */
563  const char* filename, /**< source file of the function call */
564  int line /**< line number in source file of the function call */
565  );
566 
567 /** resizes array in the block memory pool and copies the data */
568 extern
570  BMS_BLKMEM* blkmem, /**< block memory */
571  void* ptr, /**< memory element to reallocated */
572  size_t oldnum, /**< old size of array */
573  size_t newnum, /**< new size of array */
574  size_t typesize, /**< size of each component */
575  const char* filename, /**< source file of the function call */
576  int line /**< line number in source file of the function call */
577  );
578 
579 /** duplicates memory element in the block memory pool and copies the data */
580 extern
582  BMS_BLKMEM* blkmem, /**< block memory */
583  const void* source, /**< memory element to duplicate */
584  size_t size, /**< size of memory elements */
585  const char* filename, /**< source file of the function call */
586  int line /**< line number in source file of the function call */
587  );
588 
589 /** duplicates array in the block memory pool and copies the data */
590 extern
592  BMS_BLKMEM* blkmem, /**< block memory */
593  const void* source, /**< memory element to duplicate */
594  size_t num, /**< size of array to be duplicated */
595  size_t typesize, /**< size of each component */
596  const char* filename, /**< source file of the function call */
597  int line /**< line number in source file of the function call */
598  );
599 
600 /** frees memory element in the block memory pool and sets pointer to NULL */
601 extern
603  BMS_BLKMEM* blkmem, /**< block memory */
604  void** ptr, /**< pointer to pointer to memory element to free */
605  size_t size, /**< size of memory element */
606  const char* filename, /**< source file of the function call */
607  int line /**< line number in source file of the function call */
608  );
609 
610 /** frees memory element in the block memory pool if pointer is not NULL and sets pointer to NULL */
611 extern
613  BMS_BLKMEM* blkmem, /**< block memory */
614  void** ptr, /**< pointer to pointer to memory element to free */
615  size_t size, /**< size of memory element */
616  const char* filename, /**< source file of the function call */
617  int line /**< line number in source file of the function call */
618  );
619 
620 /** calls garbage collection of block memory, frees chunks without allocated memory elements, and frees
621  * chunk blocks without any chunks
622  */
623 extern
625  BMS_BLKMEM* blkmem /**< block memory */
626  );
627 
628 /** returns the number of allocated bytes in the block memory */
629 extern
631  const BMS_BLKMEM* blkmem /**< block memory */
632  );
633 
634 /** returns the number of used bytes in the block memory */
635 extern
637  const BMS_BLKMEM* blkmem /**< block memory */
638  );
639 
640 /** returns the number of allocated but not used bytes in the block memory */
641 extern
643  const BMS_BLKMEM* blkmem /**< block memory */
644  );
645 
646 /** returns the maximal number of used bytes in the block memory */
647 extern
649  const BMS_BLKMEM* blkmem /**< block memory */
650  );
651 
652 /** returns the maximal number of allocated but not used bytes in the block memory */
653 extern
655  const BMS_BLKMEM* blkmem /**< block memory */
656  );
657 
658 /** returns the maximal number of allocated bytes in the block memory */
660  const BMS_BLKMEM* blkmem /**< block memory */
661  );
662 
663 /** returns the size of the given memory element; returns 0, if the element is not member of the block memory */
664 extern
666  const BMS_BLKMEM* blkmem, /**< block memory */
667  const void* ptr /**< memory element */
668  );
669 
670 /** outputs allocation diagnostics of block memory */
671 extern
673  const BMS_BLKMEM* blkmem /**< block memory */
674  );
675 
676 /** outputs error messages, if there are allocated elements in the block memory and returns number of unfreed bytes */
677 extern
679  const BMS_BLKMEM* blkmem /**< block memory */
680  );
681 
682 
683 
684 
685 
686 /***********************************************************
687  * Buffer Memory Management
688  *
689  * Efficient memory management for temporary objects
690  ***********************************************************/
691 
692 typedef struct BMS_BufMem BMS_BUFMEM; /**< buffer memory for temporary objects */
693 
694 /* Note: values that are passed as a size_t parameter are first converted to ptrdiff_t to be sure that negative numbers
695  * are extended to the larger size. Then they are converted to size_t. Thus, negative numbers are converted to very
696  * large size_t values. This is then checked within the functions. */
697 
698 #define BMSallocBufferMemory(mem,ptr) ASSIGN((ptr), BMSallocBufferMemory_call((mem), sizeof(**(ptr)), __FILE__, __LINE__))
699 #define BMSallocBufferMemorySize(mem,ptr,size) ASSIGN((ptr), BMSallocBufferMemory_call((mem), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__))
700 #define BMSreallocBufferMemorySize(mem,ptr,size) \
701  ASSIGN((ptr), BMSreallocBufferMemory_call((mem), (void*)(*(ptr)), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__))
702 #define BMSallocBufferMemoryArray(mem,ptr,num) ASSIGN((ptr), BMSallocBufferMemoryArray_call((mem), (size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__))
703 #define BMSallocClearBufferMemoryArray(mem,ptr,num) ASSIGN((ptr), BMSallocClearBufferMemoryArray_call((mem), (size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__))
704 #define BMSreallocBufferMemoryArray(mem,ptr,num) ASSIGN((ptr), BMSreallocBufferMemoryArray_call((mem), (void*)(*(ptr)), (size_t)(ptrdiff_t)(num), \
705  sizeof(**(ptr)), __FILE__, __LINE__))
706 #define BMSduplicateBufferMemory(mem,ptr,source,size) \
707  ASSIGN((ptr), BMSduplicateBufferMemory_call((mem), (const void*)(source), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__))
708 #define BMSduplicateBufferMemoryArray(mem,ptr,source,num) ASSIGNCHECK((ptr), BMSduplicateBufferMemoryArray_call((mem), \
709  (const void*)(source), (size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__), source)
710 
711 #define BMSfreeBufferMemory(mem,ptr) BMSfreeBufferMemory_call((mem), (void**)(ptr), __FILE__, __LINE__)
712 #define BMSfreeBufferMemoryNull(mem,ptr) BMSfreeBufferMemoryNull_call((mem), (void**)(ptr), __FILE__, __LINE__)
713 #define BMSfreeBufferMemoryArray(mem,ptr) BMSfreeBufferMemory_call((mem), (void**)(ptr), __FILE__, __LINE__)
714 #define BMSfreeBufferMemoryArrayNull(mem,ptr) BMSfreeBufferMemoryNull_call((mem), (void**)(ptr), __FILE__, __LINE__)
715 #define BMSfreeBufferMemorySize(mem,ptr) BMSfreeBufferMemory_call((mem), (void**)(ptr), __FILE__, __LINE__);
716 #define BMSfreeBufferMemorySizeNull(mem,ptr) BMSfreeBufferMemoryNull_call((mem), (void**)(ptr), __FILE__, __LINE__)
717 
718 #define BMScreateBufferMemory(fac,init,clean) BMScreateBufferMemory_call((fac), (init), (clean), __FILE__, __LINE__)
719 #define BMSdestroyBufferMemory(mem) BMSdestroyBufferMemory_call((mem), __FILE__, __LINE__)
720 
721 
722 /** creates memory buffer storage */
723 extern
725  double arraygrowfac, /**< memory growing factor for dynamically allocated arrays */
726  int arraygrowinit, /**< initial size of dynamically allocated arrays */
727  unsigned int clean, /**< should the memory blocks in the buffer be initialized to zero? */
728  const char* filename, /**< source file of the function call */
729  int line /**< line number in source file of the function call */
730  );
731 
732 /** destroys buffer memory */
733 extern
735  BMS_BUFMEM** buffer, /**< pointer to memory buffer storage */
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 /** set arraygrowfac */
741 extern
743  BMS_BUFMEM* buffer, /**< pointer to memory buffer storage */
744  double arraygrowfac /**< memory growing factor for dynamically allocated arrays */
745  );
746 
747 /** set arraygrowinit */
748 extern
750  BMS_BUFMEM* buffer, /**< pointer to memory buffer storage */
751  int arraygrowinit /**< initial size of dynamically allocated arrays */
752  );
753 
754 /** allocates the next unused buffer */
755 extern
757  BMS_BUFMEM* buffer, /**< memory buffer storage */
758  size_t size, /**< minimal required size of the buffer */
759  const char* filename, /**< source file of the function call */
760  int line /**< line number in source file of the function call */
761  );
762 
763 /** allocates the next unused buffer array */
764 extern
766  BMS_BUFMEM* buffer, /**< memory buffer storage */
767  size_t num, /**< size of array to be allocated */
768  size_t typesize, /**< size of components */
769  const char* filename, /**< source file of the function call */
770  int line /**< line number in source file of the function call */
771  );
772 
773 /** allocates the next unused buffer and clears it */
774 extern
776  BMS_BUFMEM* buffer, /**< memory buffer storage */
777  size_t num, /**< size of array to be allocated */
778  size_t typesize, /**< size of components */
779  const char* filename, /**< source file of the function call */
780  int line /**< line number in source file of the function call */
781  );
782 
783 /** reallocates the buffer to at least the given size */
784 extern
786  BMS_BUFMEM* buffer, /**< memory buffer storage */
787  void* ptr, /**< pointer to the allocated memory buffer */
788  size_t size, /**< minimal required size of the buffer */
789  const char* filename, /**< source file of the function call */
790  int line /**< line number in source file of the function call */
791  );
792 
793 /** reallocates an array in the buffer to at least the given size */
794 extern
796  BMS_BUFMEM* buffer, /**< memory buffer storage */
797  void* ptr, /**< pointer to the allocated memory buffer */
798  size_t num, /**< size of array to be allocated */
799  size_t typesize, /**< size of components */
800  const char* filename, /**< source file of the function call */
801  int line /**< line number in source file of the function call */
802  );
803 
804 /** allocates the next unused buffer and copies the given memory into the buffer */
805 extern
807  BMS_BUFMEM* buffer, /**< memory buffer storage */
808  const void* source, /**< memory block to copy into the buffer */
809  size_t size, /**< minimal required size of the buffer */
810  const char* filename, /**< source file of the function call */
811  int line /**< line number in source file of the function call */
812  );
813 
814 /** allocates an array in the next unused buffer and copies the given memory into the buffer */
815 extern
817  BMS_BUFMEM* buffer, /**< memory buffer storage */
818  const void* source, /**< memory block to copy into the buffer */
819  size_t num, /**< size of array to be allocated */
820  size_t typesize, /**< size of components */
821  const char* filename, /**< source file of the function call */
822  int line /**< line number in source file of the function call */
823  );
824 
825 /** frees a buffer and sets pointer to NULL */
826 extern
828  BMS_BUFMEM* buffer, /**< memory buffer storage */
829  void** ptr, /**< pointer to pointer to the allocated memory buffer */
830  const char* filename, /**< source file of the function call */
831  int line /**< line number in source file of the function call */
832  );
833 
834 /** frees a buffer if pointer is not NULL and sets pointer to NULL */
835 extern
837  BMS_BUFMEM* buffer, /**< memory buffer storage */
838  void** ptr, /**< pointer to pointer to the allocated memory buffer */
839  const char* filename, /**< source file of the function call */
840  int line /**< line number in source file of the function call */
841  );
842 
843 /** gets number of used buffers */
844 extern
846  BMS_BUFMEM* buffer /**< memory buffer storage */
847  );
848 
849 /** returns the number of allocated bytes in the buffer memory */
850 extern
851 long long BMSgetBufferMemoryUsed(
852  const BMS_BUFMEM* bufmem /**< buffer memory */
853  );
854 
855 /** outputs statistics about currently allocated buffers to the screen */
856 extern
858  BMS_BUFMEM* buffer /**< memory buffer storage */
859  );
860 
861 
862 #ifdef __cplusplus
863 }
864 #endif
865 
866 #endif
void * BMSreallocBufferMemory_call(BMS_BUFMEM *buffer, void *ptr, size_t size, const char *filename, int line)
Definition: memory.c:2882
void BMSfreeBufferMemoryNull_call(BMS_BUFMEM *buffer, void **ptr, const char *filename, int line)
Definition: memory.c:3068
void BMSdestroyChunkMemory_call(BMS_CHKMEM **chkmem, const char *filename, int line)
Definition: memory.c:1489
void * BMSallocBlockMemory_call(BMS_BLKMEM *blkmem, size_t size, const char *filename, int line)
Definition: memory.c:1873
struct BMS_ChkMem BMS_CHKMEM
Definition: memory.h:284
BMS_CHKMEM * BMScreateChunkMemory_call(size_t size, int initchunksize, int garbagefactor, const char *filename, int line)
Definition: memory.c:1447
void BMSfreeMemoryNull_call(void **ptr, const char *filename, int line)
Definition: memory.c:627
void * BMSallocChunkMemory_call(BMS_CHKMEM *chkmem, size_t size, const char *filename, int line)
Definition: memory.c:1509
void * BMSallocBlockMemoryArray_call(BMS_BLKMEM *blkmem, size_t num, size_t typesize, const char *filename, int line)
Definition: memory.c:1893
void * BMSallocClearBlockMemoryArray_call(BMS_BLKMEM *blkmem, size_t num, size_t typesize, const char *filename, int line)
Definition: memory.c:1914
void BMSclearBlockMemory_call(BMS_BLKMEM *blkmem, const char *filename, int line)
Definition: memory.c:1753
double arraygrowfac
Definition: memory.c:2470
void * BMSallocBufferMemoryArray_call(BMS_BUFMEM *buffer, size_t num, size_t typesize, const char *filename, int line)
Definition: memory.c:2770
size_t * size
Definition: memory.c:2464
int BMSisAligned(size_t size)
Definition: memory.c:763
void BMSdestroyBlockMemory_call(BMS_BLKMEM **blkmem, const char *filename, int line)
Definition: memory.c:1787
long long BMScheckEmptyBlockMemory_call(const BMS_BLKMEM *blkmem)
Definition: memory.c:2382
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:1972
size_t BMSgetBlockPointerSize_call(const BMS_BLKMEM *blkmem, const void *ptr)
Definition: memory.c:2238
void * BMSduplicateChunkMemory_call(BMS_CHKMEM *chkmem, const void *source, size_t size, const char *filename, int line)
Definition: memory.c:1536
void BMSfreeChunkMemory_call(BMS_CHKMEM *chkmem, void **ptr, size_t size, const char *filename, int line)
Definition: memory.c:1558
long long BMSgetBlockMemoryUsedMax_call(const BMS_BLKMEM *blkmem)
Definition: memory.c:2208
long long BMSgetBlockMemoryAllocated_call(const BMS_BLKMEM *blkmem)
Definition: memory.c:2178
void * BMSallocBufferMemory_call(BMS_BUFMEM *buffer, size_t size, const char *filename, int line)
Definition: memory.c:2750
void BMSsetBufferMemoryArraygrowinit(BMS_BUFMEM *buffer, int arraygrowinit)
Definition: memory.c:2557
void * BMSallocClearBufferMemoryArray_call(BMS_BUFMEM *buffer, size_t num, size_t typesize, const char *filename, int line)
Definition: memory.c:2791
void * BMSduplicateMemory_call(const void *source, size_t size, const char *filename, int line)
Definition: memory.c:565
void * BMSreallocBlockMemory_call(BMS_BLKMEM *blkmem, void *ptr, size_t oldsize, size_t newsize, const char *filename, int line)
Definition: memory.c:1932
void * BMSreallocMemoryArray_call(void *ptr, size_t num, size_t typesize, const char *filename, int line)
Definition: memory.c:477
void * BMSallocMemoryArray_call(size_t num, size_t typesize, const char *filename, int line)
Definition: memory.c:397
void BMSdestroyBufferMemory_call(BMS_BUFMEM **buffer, const char *filename, int line)
Definition: memory.c:2512
void BMSdisplayMemory_call(void)
Definition: memory.c:290
BMS_BLKMEM * BMScreateBlockMemory_call(int initchunksize, int garbagefactor, const char *filename, int line)
Definition: memory.c:1719
void BMSclearMemory_call(void *ptr, size_t size)
Definition: memory.c:520
void BMSfreeBufferMemory_call(BMS_BUFMEM *buffer, void **ptr, const char *filename, int line)
Definition: memory.c:3045
void * BMSduplicateBlockMemory_call(BMS_BLKMEM *blkmem, const void *source, size_t size, const char *filename, int line)
Definition: memory.c:2011
void BMScheckEmptyMemory_call(void)
Definition: memory.c:300
void BMSgarbagecollectChunkMemory_call(BMS_CHKMEM *chkmem)
Definition: memory.c:1611
void * BMSreallocMemory_call(void *ptr, size_t size, const char *filename, int line)
Definition: memory.c:437
long long BMSgetBlockMemoryUsed_call(const BMS_BLKMEM *blkmem)
Definition: memory.c:2188
long long BMSgetBlockMemoryAllocatedMax_call(const BMS_BLKMEM *blkmem)
Definition: memory.c:2228
void * BMSduplicateBlockMemoryArray_call(BMS_BLKMEM *blkmem, const void *source, size_t num, size_t typesize, const char *filename, int line)
Definition: memory.c:2031
void BMSfreeBlockMemoryNull_call(BMS_BLKMEM *blkmem, void **ptr, size_t size, const char *filename, int line)
Definition: memory.c:2123
long long BMSgetChunkMemoryUsed_call(const BMS_CHKMEM *chkmem)
Definition: memory.c:1621
void BMSgarbagecollectBlockMemory_call(BMS_BLKMEM *blkmem)
Definition: memory.c:2144
void BMSprintBufferMemory(BMS_BUFMEM *buffer)
Definition: memory.c:3116
void * BMSallocMemory_call(size_t size, const char *filename, int line)
Definition: memory.c:361
unsigned int arraygrowinit
Definition: memory.c:2471
void BMSfreeMemory_call(void **ptr, const char *filename, int line)
Definition: memory.c:604
BMS_BUFMEM * BMScreateBufferMemory_call(double arraygrowfac, int arraygrowinit, unsigned int clean, const char *filename, int line)
Definition: memory.c:2476
void * BMSallocClearMemory_call(size_t num, size_t typesize, const char *filename, int line)
Definition: memory.c:320
long long BMSgetBlockMemoryUnusedMax_call(const BMS_BLKMEM *blkmem)
Definition: memory.c:2218
void BMSsetBufferMemoryArraygrowfac(BMS_BUFMEM *buffer, double arraygrowfac)
Definition: memory.c:2545
void * BMSduplicateBufferMemory_call(BMS_BUFMEM *buffer, const void *source, size_t size, const char *filename, int line)
Definition: memory.c:2925
void BMSmoveMemory_call(void *ptr, const void *source, size_t size)
Definition: memory.c:550
void * BMSreallocBufferMemoryArray_call(BMS_BUFMEM *buffer, void *ptr, size_t num, size_t typesize, const char *filename, int line)
Definition: memory.c:2903
void BMSfreeChunkMemoryNull_call(BMS_CHKMEM *chkmem, void **ptr, size_t size, const char *filename, int line)
Definition: memory.c:1587
long long BMSgetBlockMemoryUnused_call(const BMS_BLKMEM *blkmem)
Definition: memory.c:2198
size_t BMSgetNUsedBufferMemory(BMS_BUFMEM *buffer)
Definition: memory.c:3088
void BMSalignMemsize(size_t *size)
Definition: memory.c:754
void BMScopyMemory_call(void *ptr, const void *source, size_t size)
Definition: memory.c:533
void BMSfreeBlockMemory_call(BMS_BLKMEM *blkmem, void **ptr, size_t size, const char *filename, int line)
Definition: memory.c:2101
void BMSdisplayBlockMemory_call(const BMS_BLKMEM *blkmem)
Definition: memory.c:2258
void BMSclearChunkMemory_call(BMS_CHKMEM *chkmem, const char *filename, int line)
Definition: memory.c:1471
size_t BMSgetPointerSize_call(const void *ptr)
Definition: memory.c:282
struct BMS_BlkMem BMS_BLKMEM
Definition: memory.h:419
unsigned int clean
Definition: memory.c:2467
long long BMSgetMemoryUsed_call(void)
Definition: memory.c:310
void * BMSduplicateMemoryArray_call(const void *source, size_t num, size_t typesize, const char *filename, int line)
Definition: memory.c:584
long long BMSgetBufferMemoryUsed(const BMS_BUFMEM *bufmem)
Definition: memory.c:3098
void * BMSduplicateBufferMemoryArray_call(BMS_BUFMEM *buffer, const void *source, size_t num, size_t typesize, const char *filename, int line)
Definition: memory.c:2948