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-2019 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 /*
33  * include build configuration flags
34  */
35 #ifndef NO_CONFIG_HEADER
36 #include "scip/config.h"
37 #include "scip/scip_export.h"
38 #endif
39 
40 #ifdef __cplusplus
41 
42 
43 /* special thanks to Daniel Junglas for following template and macros */
44 
45 template<typename T> T* docast(T*, void *v);
46 template<typename T> T* docast(T*, void *v) { return reinterpret_cast<T*>(v); }
47 
48 /* For C++11, we can easily check whether the types for memory functions like BMSduplicateXYZArray() are equal. */
49 #if __cplusplus > 199711L
50 #include <type_traits>
51 
52 /* the following adds a type check for the parameters, used in ASSIGNCHECK below */
53 template<typename T1, typename T2> T1* docastcheck(T1* v1, void* v, T2* v2)
54 {
55  typedef typename std::remove_const<T1>::type t1;
56  typedef typename std::remove_const<T2>::type t2;
57  static_assert(std::is_same<t1, t2>::value, "need equal types");
58  return reinterpret_cast<T1*>(v);
59 }
60 #else
61 /* for older compilers do nothing */
62 template<typename T1, typename T2> T1* docastcheck(T1* v1, void* v, T2* v2) { return reinterpret_cast<T1*>(v); }
63 #endif
64 
65 
66 extern "C" {
67 
68 #define ASSIGN(pointerstarstar, voidstarfunction) (*(pointerstarstar) = docast(*(pointerstarstar), (voidstarfunction)))
69 #define ASSIGNCHECK(pointerstarstar, voidstarfunction, origpointer) (*(pointerstarstar) = docastcheck(*(pointerstarstar), (voidstarfunction), (origpointer)))
70 
71 #else
72 
73 #define ASSIGN(pointerstarstar, voidstarfunction) (*(pointerstarstar) = (voidstarfunction))
74 #define ASSIGNCHECK(pointerstarstar, voidstarfunction, origpointer) (*(pointerstarstar) = (voidstarfunction))
75 
76 #endif
77 
78 /*
79  * Define the macro SCIP_EXPORT depending if the OS is Windows or not
80  */
81 #ifndef SCIP_EXPORT
82 
83 #if defined(_WIN32) || defined(_WIN64)
84 #define SCIP_EXPORT __declspec(dllexport)
85 #else
86 #define SCIP_EXPORT
87 #endif
88 
89 #endif
90 
91 /* define if not already existing to make file independent from def.h */
92 #ifndef SCIP_UNUSED
93 #define SCIP_UNUSED(x) ((void) (x))
94 #endif
95 
96 
97 /*************************************************************************************
98  * Standard Memory Management
99  *
100  * In debug mode, these methods extend malloc() and free() by logging all currently
101  * allocated memory elements in an allocation list. This can be used as a simple leak
102  * detection.
103  *************************************************************************************/
104 
105 /* Note: values that are passed as a size_t parameter are first converted to ptrdiff_t to be sure that negative numbers
106  * are extended to the larger size. Then they are converted to size_t. Thus, negative numbers are converted to very
107  * large size_t values. This is then checked within the functions. */
108 
109 #define BMSallocMemory(ptr) ASSIGN((ptr), BMSallocMemory_call( sizeof(**(ptr)), __FILE__, __LINE__ ))
110 #define BMSallocMemorySize(ptr,size) ASSIGN((ptr), BMSallocMemory_call( (size_t)(ptrdiff_t)(size), __FILE__, __LINE__ ))
111 #define BMSallocMemoryCPP(size) BMSallocMemory_call( (size_t)(ptrdiff_t)(size), __FILE__, __LINE__ )
112 #define BMSallocClearMemorySize(ptr,size) ASSIGN((ptr), BMSallocClearMemory_call((size_t)(1), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__ ))
113 #define BMSallocMemoryArray(ptr,num) ASSIGN((ptr), BMSallocMemoryArray_call((size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__ ))
114 #define BMSallocMemoryArrayCPP(num,size) BMSallocMemoryArray_call( (size_t)(ptrdiff_t)(num), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__ )
115 #define BMSallocClearMemoryArray(ptr,num) ASSIGN((ptr), BMSallocClearMemory_call((size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__ ))
116 #define BMSreallocMemorySize(ptr,size) ASSIGN((ptr), BMSreallocMemory_call((void*)(*(ptr)), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__ ))
117 #define BMSreallocMemoryArray(ptr,num) ASSIGN((ptr), BMSreallocMemoryArray_call( *(ptr), (size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__ ))
118 
119 #define BMSclearMemory(ptr) BMSclearMemory_call( (void*)(ptr), sizeof(*(ptr)) )
120 #define BMSclearMemoryArray(ptr, num) BMSclearMemory_call( (void*)(ptr), (size_t)(ptrdiff_t)(num)*sizeof(*(ptr)) )
121 #define BMSclearMemorySize(ptr, size) BMSclearMemory_call( (void*)(ptr), (size_t)(ptrdiff_t)(size) )
122 
123 #define BMScopyMemory(ptr, source) BMScopyMemory_call( (void*)(ptr), (const void*)(source), sizeof(*(ptr)) )
124 #define BMScopyMemoryArray(ptr, source, num) BMScopyMemory_call( (void*)(ptr), (const void*)(source), (size_t)(ptrdiff_t)(num)*sizeof(*(ptr)) )
125 #define BMScopyMemorySize(ptr, source, size) BMScopyMemory_call( (void*)(ptr), (const void*)(source), (size_t)(ptrdiff_t)(size) )
126 
127 #define BMSmoveMemory(ptr, source) BMSmoveMemory_call( (void*)(ptr), (const void*)(source), sizeof(*(ptr)) )
128 #define BMSmoveMemoryArray(ptr, source, num) BMSmoveMemory_call( (void*)(ptr), (const void*)(source), (size_t)(ptrdiff_t)(num) * sizeof(*(ptr)) )
129 #define BMSmoveMemorySize(ptr, source, size) BMSmoveMemory_call( (void*)(ptr), (const void*)(source), (size_t)(ptrdiff_t)(size) )
130 
131 #define BMSduplicateMemory(ptr, source) ASSIGN((ptr), BMSduplicateMemory_call( (const void*)(source), sizeof(**(ptr)), __FILE__, __LINE__ ))
132 #define BMSduplicateMemorySize(ptr, source, size) ASSIGN((ptr), BMSduplicateMemory_call( (const void*)(source), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__ ))
133 #define BMSduplicateMemoryArray(ptr, source, num) ASSIGNCHECK((ptr), BMSduplicateMemoryArray_call( (const void*)(source), (size_t)(ptrdiff_t)(num), \
134  sizeof(**(ptr)), __FILE__, __LINE__ ), source)
135 #define BMSfreeMemory(ptr) BMSfreeMemory_call( (void**)(ptr), __FILE__, __LINE__ )
136 #define BMSfreeMemoryNull(ptr) BMSfreeMemoryNull_call( (void**)(ptr), __FILE__, __LINE__ )
137 #define BMSfreeMemoryArray(ptr) BMSfreeMemory_call( (void**)(ptr), __FILE__, __LINE__ )
138 #define BMSfreeMemoryArrayNull(ptr) BMSfreeMemoryNull_call( (void**)(ptr), __FILE__, __LINE__ )
139 #define BMSfreeMemorySize(ptr) BMSfreeMemory_call( (void**)(ptr), __FILE__, __LINE__ )
140 #define BMSfreeMemorySizeNull(ptr) BMSfreeMemoryNull_call( (void**)(ptr), __FILE__, __LINE__ )
141 
142 #ifndef NDEBUG
143 #define BMSgetPointerSize(ptr) BMSgetPointerSize_call(ptr)
144 #define BMSdisplayMemory() BMSdisplayMemory_call()
145 #define BMScheckEmptyMemory() BMScheckEmptyMemory_call()
146 #define BMSgetMemoryUsed() BMSgetMemoryUsed_call()
147 #else
148 #define BMSgetPointerSize(ptr) 0
149 #define BMSdisplayMemory() /**/
150 #define BMScheckEmptyMemory() /**/
151 #define BMSgetMemoryUsed() 0LL
152 #endif
153 
154 /** allocates array and initializes it with 0; returns NULL if memory allocation failed */
157  size_t num, /**< number of memory element to allocate */
158  size_t typesize, /**< 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 memory; returns NULL if memory allocation failed */
165 void* BMSallocMemory_call(
166  size_t size, /**< size of memory element to allocate */
167  const char* filename, /**< source file where the allocation is performed */
168  int line /**< line number in source file where the allocation is performed */
169  );
170 
171 /** allocates array; returns NULL if memory allocation failed */
174  size_t num, /**< number of components of array to allocate */
175  size_t typesize, /**< size of each component */
176  const char* filename, /**< source file where the allocation is performed */
177  int line /**< line number in source file where the allocation is performed */
178  );
179 
180 /** allocates memory; returns NULL if memory allocation failed */
183  void* ptr, /**< pointer to memory to reallocate */
184  size_t size, /**< new size of memory element */
185  const char* filename, /**< source file where the reallocation is performed */
186  int line /**< line number in source file where the reallocation is performed */
187  );
188 
189 /** reallocates array; returns NULL if memory allocation failed */
192  void* ptr, /**< pointer to memory to reallocate */
193  size_t num, /**< number of components of array to allocate */
194  size_t typesize, /**< size of each component */
195  const char* filename, /**< source file where the reallocation is performed */
196  int line /**< line number in source file where the reallocation is performed */
197  );
198 
199 /** clears a memory element (i.e. fills it with zeros) */
202  void* ptr, /**< pointer to memory element */
203  size_t size /**< size of memory element */
204  );
205 
206 /** copies the contents of one memory element into another memory element */
208 void BMScopyMemory_call(
209  void* ptr, /**< pointer to target memory element */
210  const void* source, /**< pointer to source memory element */
211  size_t size /**< size of memory element to copy */
212  );
213 
214 /** moves the contents of one memory element into another memory element, should be used if both elements overlap,
215  * otherwise BMScopyMemory is faster
216  */
218 void BMSmoveMemory_call(
219  void* ptr, /**< pointer to target memory element */
220  const void* source, /**< pointer to source memory element */
221  size_t size /**< size of memory element to copy */
222  );
223 
224 /** allocates memory and copies the contents of the given memory element into the new memory element */
227  const void* source, /**< pointer to source memory element */
228  size_t size, /**< size of memory element to copy */
229  const char* filename, /**< source file where the duplication is performed */
230  int line /**< line number in source file where the duplication is performed */
231  );
232 
233 /** allocates array and copies the contents of the given source array into the new array */
236  const void* source, /**< pointer to source memory element */
237  size_t num, /**< number of components of array to allocate */
238  size_t typesize, /**< size of each component */
239  const char* filename, /**< source file where the duplication is performed */
240  int line /**< line number in source file where the duplication is performed */
241  );
242 
243 /** frees an allocated memory element and sets pointer to NULL */
245 void BMSfreeMemory_call(
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 /** frees an allocated memory element if pointer is not NULL and sets pointer to NULL */
254  void** ptr, /**< pointer to pointer to memory element */
255  const char* filename, /**< source file where the deallocation is performed */
256  int line /**< line number in source file where the deallocation is performed */
257  );
258 
259 /** returns the size of an allocated memory element */
262  const void* ptr /**< pointer to allocated memory */
263  );
264 
265 /** outputs information about currently allocated memory to the screen */
268  void
269  );
270 
271 /** displays a warning message on the screen, if allocated memory exists */
274  void
275  );
276 
277 /** returns total number of allocated bytes */
279 long long BMSgetMemoryUsed_call(
280  void
281  );
282 
283 
284 
285 
286 /********************************************************************
287  * Chunk Memory Management
288  *
289  * Efficient memory management for multiple objects of the same size
290  ********************************************************************/
291 
292 typedef struct BMS_ChkMem BMS_CHKMEM; /**< collection of memory chunks of the same element size */
293 
294 
295 #ifndef BMS_NOBLOCKMEM
296 
297 #define BMScreateChunkMemory(sz,isz,gbf) BMScreateChunkMemory_call( (sz), (isz), (gbf), __FILE__, __LINE__ )
298 #define BMSclearChunkMemory(mem) BMSclearChunkMemory_call( (mem), __FILE__, __LINE__ )
299 #define BMSdestroyChunkMemory(mem) BMSdestroyChunkMemory_call( (mem), __FILE__, __LINE__ )
300 
301 #define BMSallocChunkMemory(mem,ptr) ASSIGN((ptr), BMSallocChunkMemory_call((mem), sizeof(**(ptr)), __FILE__, __LINE__))
302 #define BMSduplicateChunkMemory(mem, ptr, source) ASSIGN((ptr), BMSduplicateChunkMemory_call((mem), (const void*)(source), \
303  sizeof(**(ptr)), __FILE__, __LINE__ ))
304 #define BMSfreeChunkMemory(mem,ptr) BMSfreeChunkMemory_call( (mem), (void**)(ptr), sizeof(**(ptr)), __FILE__, __LINE__ )
305 #define BMSfreeChunkMemoryNull(mem,ptr) BMSfreeChunkMemoryNull_call( (mem), (void**)(ptr) )
306 #define BMSgarbagecollectChunkMemory(mem) BMSgarbagecollectChunkMemory_call(mem)
307 #define BMSgetChunkMemoryUsed(mem) BMSgetChunkMemoryUsed_call(mem)
308 
309 #else
310 
311 /* block memory management mapped to standard memory management */
312 
313 #define BMScreateChunkMemory(sz,isz,gbf) (void*)(0x01) /* dummy to not return a NULL pointer */
314 #define BMSclearChunkMemory(mem) /**/
315 #define BMSclearChunkMemoryNull(mem) /**/
316 #define BMSdestroyChunkMemory(mem) /**/
317 #define BMSdestroyChunkMemoryNull(mem) /**/
318 #define BMSallocChunkMemory(mem,ptr) BMSallocMemory(ptr)
319 #define BMSduplicateChunkMemory(mem, ptr, source) BMSduplicateMemory(ptr,source)
320 #define BMSfreeChunkMemory(mem,ptr) BMSfreeMemory(ptr)
321 #define BMSfreeChunkMemoryNull(mem,ptr) BMSfreeMemoryNull(ptr)
322 #define BMSgarbagecollectChunkMemory(mem) /**/
323 #define BMSgetChunkMemoryUsed(mem) 0LL
324 
325 #endif
326 
327 
328 /** aligns the given byte size corresponding to the minimal alignment for chunk and block memory */
330 void BMSalignMemsize(
331  size_t* size /**< pointer to the size to align */
332  );
333 
334 /** checks whether the given size meets the alignment conditions for chunk and block memory */
336 int BMSisAligned(
337  size_t size /**< size to check for alignment */
338  );
339 
340 /** creates a new chunk block data structure */
343  size_t size, /**< element size of the chunk block */
344  int initchunksize, /**< number of elements in the first chunk of the chunk block */
345  int garbagefactor, /**< garbage collector is called, if at least garbagefactor * avg. chunksize
346  * elements are free (-1: disable garbage collection) */
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 /** clears a chunk block data structure */
354  BMS_CHKMEM* chkmem, /**< 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 /** destroys and frees a chunk block data structure */
362  BMS_CHKMEM** chkmem, /**< pointer to chunk block */
363  const char* filename, /**< source file of the function call */
364  int line /**< line number in source file of the function call */
365  );
366 
367 /** allocates a memory element of the given chunk block */
370  BMS_CHKMEM* chkmem, /**< chunk block */
371  size_t size, /**< size of memory element to allocate (only needed for sanity check) */
372  const char* filename, /**< source file of the function call */
373  int line /**< line number in source file of the function call */
374  );
375 
376 /** duplicates a given memory element by allocating a new element of the same chunk block and copying the data */
379  BMS_CHKMEM* chkmem, /**< chunk block */
380  const void* source, /**< source memory element */
381  size_t size, /**< size of memory element to allocate (only needed for sanity check) */
382  const char* filename, /**< source file of the function call */
383  int line /**< line number in source file of the function call */
384  );
385 
386 /** frees a memory element of the given chunk block and sets pointer to NULL */
389  BMS_CHKMEM* chkmem, /**< chunk block */
390  void** ptr, /**< pointer to pointer to memory element to free */
391  size_t size, /**< size of memory element to allocate (only needed for sanity check) */
392  const char* filename, /**< source file of the function call */
393  int line /**< line number in source file of the function call */
394  );
395 
396 /** frees a memory element of the given chunk block if pointer is not NULL and sets pointer to NULL */
399  BMS_CHKMEM* chkmem, /**< chunk block */
400  void** ptr, /**< pointer to pointer to memory element to free */
401  size_t size, /**< size of memory element to allocate (only needed for sanity check) */
402  const char* filename, /**< source file of the function call */
403  int line /**< line number in source file of the function call */
404  );
405 
406 /** calls garbage collection of chunk block and frees chunks without allocated memory elements */
409  BMS_CHKMEM* chkmem /**< chunk block */
410  );
411 
412 /** returns the number of allocated bytes in the chunk block */
415  const BMS_CHKMEM* chkmem /**< chunk block */
416  );
417 
418 
419 
420 
421 /***********************************************************
422  * Block Memory Management
423  *
424  * Efficient memory management for objects of varying sizes
425  ***********************************************************/
426 
427 typedef struct BMS_BlkMem BMS_BLKMEM; /**< block memory: collection of chunk blocks */
428 
429 #ifndef BMS_NOBLOCKMEM
430 
431 /* block memory methods for faster memory access */
432 
433 /* Note: values that are passed as a size_t parameter are first converted to ptrdiff_t to be sure that negative numbers
434  * are extended to the larger size. Then they are converted to size_t. Thus, negative numbers are converted to very
435  * large size_t values. This is then checked within the functions. */
436 
437 #define BMScreateBlockMemory(csz,gbf) BMScreateBlockMemory_call( (csz), (gbf), __FILE__, __LINE__ )
438 #define BMSclearBlockMemory(mem) BMSclearBlockMemory_call( (mem), __FILE__, __LINE__ )
439 #define BMSdestroyBlockMemory(mem) BMSdestroyBlockMemory_call( (mem), __FILE__, __LINE__ )
440 
441 #define BMSallocBlockMemory(mem,ptr) ASSIGN((ptr), BMSallocBlockMemory_call((mem), sizeof(**(ptr)), __FILE__, __LINE__))
442 #define BMSallocBlockMemorySize(mem,ptr,size) ASSIGN((ptr), BMSallocBlockMemory_call((mem), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__))
443 #define BMSallocBlockMemoryArray(mem,ptr,num) ASSIGN((ptr), BMSallocBlockMemoryArray_call((mem), (size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__))
444 #define BMSallocClearBlockMemoryArray(mem,ptr,num) ASSIGN((ptr), BMSallocClearBlockMemoryArray_call((mem), (size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__))
445 #define BMSreallocBlockMemorySize(mem,ptr,oldsize,newsize) ASSIGN((ptr), BMSreallocBlockMemory_call((mem), (void*)(*(ptr)), \
446  (size_t)(ptrdiff_t)(oldsize), (size_t)(ptrdiff_t)(newsize), __FILE__, __LINE__))
447 #define BMSreallocBlockMemoryArray(mem,ptr,oldnum,newnum) ASSIGN((ptr), BMSreallocBlockMemoryArray_call((mem), (void*)(*(ptr)), \
448  (size_t)(ptrdiff_t)(oldnum), (size_t)(ptrdiff_t)(newnum), sizeof(**(ptr)), __FILE__, __LINE__))
449 #define BMSduplicateBlockMemory(mem, ptr, source) ASSIGN((ptr), BMSduplicateBlockMemory_call((mem), (const void*)(source), \
450  sizeof(**(ptr)), __FILE__, __LINE__ ))
451 #define BMSduplicateBlockMemoryArray(mem, ptr, source, num) ASSIGNCHECK((ptr), BMSduplicateBlockMemoryArray_call( (mem), (const void*)(source), \
452  (size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__ ), source)
453 
454 #define BMSfreeBlockMemory(mem,ptr) BMSfreeBlockMemory_call( (mem), (void**)(ptr), sizeof(**(ptr)), __FILE__, __LINE__ )
455 #define BMSfreeBlockMemoryNull(mem,ptr) BMSfreeBlockMemoryNull_call( (mem), (void**)(ptr), sizeof(**(ptr)), __FILE__, __LINE__ )
456 #define BMSfreeBlockMemoryArray(mem,ptr,num) BMSfreeBlockMemory_call( (mem), (void**)(ptr), (num)*sizeof(**(ptr)), __FILE__, __LINE__ )
457 #define BMSfreeBlockMemoryArrayNull(mem,ptr,num) BMSfreeBlockMemoryNull_call( (mem), (void**)(ptr), (num)*sizeof(**(ptr)), __FILE__, __LINE__ )
458 #define BMSfreeBlockMemorySize(mem,ptr,size) BMSfreeBlockMemory_call( (mem), (void**)(ptr), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__ )
459 #define BMSfreeBlockMemorySizeNull(mem,ptr,size) BMSfreeBlockMemory_call( (mem), (void**)(ptr), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__ )
460 
461 #define BMSgarbagecollectBlockMemory(mem) BMSgarbagecollectBlockMemory_call(mem)
462 #define BMSgetBlockMemoryAllocated(mem) BMSgetBlockMemoryAllocated_call(mem)
463 #define BMSgetBlockMemoryUsed(mem) BMSgetBlockMemoryUsed_call(mem)
464 #define BMSgetBlockMemoryUnused(mem) BMSgetBlockMemoryUnused_call(mem)
465 #define BMSgetBlockMemoryUsedMax(mem) BMSgetBlockMemoryUsedMax_call(mem)
466 #define BMSgetBlockMemoryUnusedMax(mem) BMSgetBlockMemoryUnusedMax_call(mem)
467 #define BMSgetBlockMemoryAllocatedMax(mem) BMSgetBlockMemoryAllocatedMax_call(mem)
468 #define BMSgetBlockPointerSize(mem,ptr) BMSgetBlockPointerSize_call((mem), (ptr))
469 #define BMSdisplayBlockMemory(mem) BMSdisplayBlockMemory_call(mem)
470 #define BMSblockMemoryCheckEmpty(mem) BMScheckEmptyBlockMemory_call(mem)
471 
472 #else
473 
474 /* block memory management mapped to standard memory management */
475 
476 #define BMScreateBlockMemory(csz,gbf) (SCIP_UNUSED(csz), SCIP_UNUSED(gbf), (void*)(0x01)) /* dummy to not return a NULL pointer */
477 #define BMSclearBlockMemory(mem) SCIP_UNUSED(mem)
478 #define BMSclearBlockMemoryNull(mem) SCIP_UNUSED(mem)
479 #define BMSdestroyBlockMemory(mem) SCIP_UNUSED(mem)
480 #define BMSdestroyBlockMemoryNull(mem) SCIP_UNUSED(mem)
481 #define BMSallocBlockMemory(mem,ptr) (SCIP_UNUSED(mem), BMSallocMemory(ptr))
482 #define BMSallocBlockMemoryArray(mem,ptr,num) (SCIP_UNUSED(mem), BMSallocMemoryArray(ptr,num))
483 #define BMSallocClearBlockMemoryArray(mem,ptr,num) (SCIP_UNUSED(mem), BMSallocClearMemoryArray(ptr,num))
484 #define BMSallocBlockMemorySize(mem,ptr,size) (SCIP_UNUSED(mem), BMSallocMemorySize(ptr,size))
485 #define BMSreallocBlockMemoryArray(mem,ptr,oldnum,newnum) (SCIP_UNUSED(mem), SCIP_UNUSED(oldnum), BMSreallocMemoryArray(ptr,newnum))
486 #define BMSreallocBlockMemorySize(mem,ptr,oldsize,newsize) (SCIP_UNUSED(mem), SCIP_UNUSED(oldsize), BMSreallocMemorySize(ptr,newsize))
487 #define BMSduplicateBlockMemory(mem, ptr, source) (SCIP_UNUSED(mem), BMSduplicateMemory(ptr,source))
488 #define BMSduplicateBlockMemoryArray(mem, ptr, source, num) (SCIP_UNUSED(mem), BMSduplicateMemoryArray(ptr,source,num))
489 #define BMSfreeBlockMemory(mem,ptr) (SCIP_UNUSED(mem), BMSfreeMemory(ptr))
490 #define BMSfreeBlockMemoryNull(mem,ptr) (SCIP_UNUSED(mem), BMSfreeMemoryNull(ptr))
491 #define BMSfreeBlockMemoryArray(mem,ptr,num) (SCIP_UNUSED(mem), SCIP_UNUSED(num), BMSfreeMemoryArray(ptr))
492 #define BMSfreeBlockMemoryArrayNull(mem,ptr,num) (SCIP_UNUSED(mem), SCIP_UNUSED(num), BMSfreeMemoryArrayNull(ptr))
493 #define BMSfreeBlockMemorySize(mem,ptr,size) (SCIP_UNUSED(mem), SCIP_UNUSED(size), BMSfreeMemory(ptr))
494 #define BMSfreeBlockMemorySizeNull(mem,ptr,size) (SCIP_UNUSED(mem), SCIP_UNUSED(size), BMSfreeMemoryNull(ptr))
495 #define BMSgarbagecollectBlockMemory(mem) SCIP_UNUSED(mem)
496 #define BMSgetBlockMemoryAllocated(mem) (SCIP_UNUSED(mem), 0LL)
497 #define BMSgetBlockMemoryUsed(mem) (SCIP_UNUSED(mem), 0LL)
498 #define BMSgetBlockMemoryUnused(mem) (SCIP_UNUSED(mem), 0LL)
499 #define BMSgetBlockMemoryUsedMax(mem) (SCIP_UNUSED(mem), 0LL)
500 #define BMSgetBlockMemoryUnusedMax(mem) (SCIP_UNUSED(mem), 0LL)
501 #define BMSgetBlockMemoryAllocatedMax(mem) (SCIP_UNUSED(mem), 0LL)
502 #define BMSgetBlockPointerSize(mem,ptr) (SCIP_UNUSED(mem), SCIP_UNUSED(ptr), 0)
503 #define BMSdisplayBlockMemory(mem) SCIP_UNUSED(mem)
504 #define BMSblockMemoryCheckEmpty(mem) (SCIP_UNUSED(mem), 0LL)
505 
506 #endif
507 
508 
509 /** creates a block memory allocation data structure */
512  int initchunksize, /**< number of elements in the first chunk of each chunk block */
513  int garbagefactor, /**< garbage collector is called, if at least garbagefactor * avg. chunksize
514  * elements are free (-1: disable garbage collection) */
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 /** frees all chunk blocks in the block memory */
522  BMS_BLKMEM* blkmem, /**< 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 /** clears and deletes block memory */
530  BMS_BLKMEM** blkmem, /**< pointer to block memory */
531  const char* filename, /**< source file of the function call */
532  int line /**< line number in source file of the function call */
533  );
534 
535 /** allocates memory in the block memory pool */
538  BMS_BLKMEM* blkmem, /**< block memory */
539  size_t size, /**< size of memory element to allocate */
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 /** allocates array in the block memory pool */
547  BMS_BLKMEM* blkmem, /**< block memory */
548  size_t num, /**< size of array to be allocated */
549  size_t typesize, /**< size of each component */
550  const char* filename, /**< source file of the function call */
551  int line /**< line number in source file of the function call */
552  );
553 
554 /** allocates array in the block memory pool and clears it */
557  BMS_BLKMEM* blkmem, /**< block memory */
558  size_t num, /**< size of array to be allocated */
559  size_t typesize, /**< size of each component */
560  const char* filename, /**< source file of the function call */
561  int line /**< line number in source file of the function call */
562  );
563 
564 /** resizes memory element in the block memory pool and copies the data */
567  BMS_BLKMEM* blkmem, /**< block memory */
568  void* ptr, /**< memory element to reallocated */
569  size_t oldsize, /**< old size of memory element */
570  size_t newsize, /**< new size of memory element */
571  const char* filename, /**< source file of the function call */
572  int line /**< line number in source file of the function call */
573  );
574 
575 /** resizes array in the block memory pool and copies the data */
578  BMS_BLKMEM* blkmem, /**< block memory */
579  void* ptr, /**< memory element to reallocated */
580  size_t oldnum, /**< old size of array */
581  size_t newnum, /**< new size of array */
582  size_t typesize, /**< size of each component */
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 /** duplicates memory element in the block memory pool and copies the data */
590  BMS_BLKMEM* blkmem, /**< block memory */
591  const void* source, /**< memory element to duplicate */
592  size_t size, /**< size of memory elements */
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 /** duplicates array in the block memory pool and copies the data */
600  BMS_BLKMEM* blkmem, /**< block memory */
601  const void* source, /**< memory element to duplicate */
602  size_t num, /**< size of array to be duplicated */
603  size_t typesize, /**< size of each component */
604  const char* filename, /**< source file of the function call */
605  int line /**< line number in source file of the function call */
606  );
607 
608 /** frees memory element in the block memory pool and sets pointer to NULL */
611  BMS_BLKMEM* blkmem, /**< block memory */
612  void** ptr, /**< pointer to pointer to memory element to free */
613  size_t size, /**< size of memory element */
614  const char* filename, /**< source file of the function call */
615  int line /**< line number in source file of the function call */
616  );
617 
618 /** frees memory element in the block memory pool if pointer is not NULL and sets pointer to NULL */
621  BMS_BLKMEM* blkmem, /**< block memory */
622  void** ptr, /**< pointer to pointer to memory element to free */
623  size_t size, /**< size of memory element */
624  const char* filename, /**< source file of the function call */
625  int line /**< line number in source file of the function call */
626  );
627 
628 /** calls garbage collection of block memory, frees chunks without allocated memory elements, and frees
629  * chunk blocks without any chunks
630  */
633  BMS_BLKMEM* blkmem /**< block memory */
634  );
635 
636 /** returns the number of allocated bytes in the block memory */
639  const BMS_BLKMEM* blkmem /**< block memory */
640  );
641 
642 /** returns the number of used bytes in the block memory */
645  const BMS_BLKMEM* blkmem /**< block memory */
646  );
647 
648 /** returns the number of allocated but not used bytes in the block memory */
651  const BMS_BLKMEM* blkmem /**< block memory */
652  );
653 
654 /** returns the maximal number of used bytes in the block memory */
657  const BMS_BLKMEM* blkmem /**< block memory */
658  );
659 
660 /** returns the maximal number of allocated but not used bytes in the block memory */
663  const BMS_BLKMEM* blkmem /**< block memory */
664  );
665 
666 /** returns the maximal number of allocated bytes in the block memory */
668  const BMS_BLKMEM* blkmem /**< block memory */
669  );
670 
671 /** returns the size of the given memory element; returns 0, if the element is not member of the block memory */
674  const BMS_BLKMEM* blkmem, /**< block memory */
675  const void* ptr /**< memory element */
676  );
677 
678 /** outputs allocation diagnostics of block memory */
681  const BMS_BLKMEM* blkmem /**< block memory */
682  );
683 
684 /** outputs error messages, if there are allocated elements in the block memory and returns number of unfreed bytes */
687  const BMS_BLKMEM* blkmem /**< block memory */
688  );
689 
690 
691 
692 
693 
694 /***********************************************************
695  * Buffer Memory Management
696  *
697  * Efficient memory management for temporary objects
698  ***********************************************************/
699 
700 typedef struct BMS_BufMem BMS_BUFMEM; /**< buffer memory for temporary objects */
701 
702 /* Note: values that are passed as a size_t parameter are first converted to ptrdiff_t to be sure that negative numbers
703  * are extended to the larger size. Then they are converted to size_t. Thus, negative numbers are converted to very
704  * large size_t values. This is then checked within the functions. */
705 
706 #define BMSallocBufferMemory(mem,ptr) ASSIGN((ptr), BMSallocBufferMemory_call((mem), sizeof(**(ptr)), __FILE__, __LINE__))
707 #define BMSallocBufferMemorySize(mem,ptr,size) ASSIGN((ptr), BMSallocBufferMemory_call((mem), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__))
708 #define BMSreallocBufferMemorySize(mem,ptr,size) \
709  ASSIGN((ptr), BMSreallocBufferMemory_call((mem), (void*)(*(ptr)), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__))
710 #define BMSallocBufferMemoryArray(mem,ptr,num) ASSIGN((ptr), BMSallocBufferMemoryArray_call((mem), (size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__))
711 #define BMSallocClearBufferMemoryArray(mem,ptr,num) ASSIGN((ptr), BMSallocClearBufferMemoryArray_call((mem), (size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__))
712 #define BMSreallocBufferMemoryArray(mem,ptr,num) ASSIGN((ptr), BMSreallocBufferMemoryArray_call((mem), (void*)(*(ptr)), (size_t)(ptrdiff_t)(num), \
713  sizeof(**(ptr)), __FILE__, __LINE__))
714 #define BMSduplicateBufferMemory(mem,ptr,source,size) \
715  ASSIGN((ptr), BMSduplicateBufferMemory_call((mem), (const void*)(source), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__))
716 #define BMSduplicateBufferMemoryArray(mem,ptr,source,num) ASSIGNCHECK((ptr), BMSduplicateBufferMemoryArray_call((mem), \
717  (const void*)(source), (size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__), source)
718 
719 #define BMSfreeBufferMemory(mem,ptr) BMSfreeBufferMemory_call((mem), (void**)(ptr), __FILE__, __LINE__)
720 #define BMSfreeBufferMemoryNull(mem,ptr) BMSfreeBufferMemoryNull_call((mem), (void**)(ptr), __FILE__, __LINE__)
721 #define BMSfreeBufferMemoryArray(mem,ptr) BMSfreeBufferMemory_call((mem), (void**)(ptr), __FILE__, __LINE__)
722 #define BMSfreeBufferMemoryArrayNull(mem,ptr) BMSfreeBufferMemoryNull_call((mem), (void**)(ptr), __FILE__, __LINE__)
723 #define BMSfreeBufferMemorySize(mem,ptr) BMSfreeBufferMemory_call((mem), (void**)(ptr), __FILE__, __LINE__);
724 #define BMSfreeBufferMemorySizeNull(mem,ptr) BMSfreeBufferMemoryNull_call((mem), (void**)(ptr), __FILE__, __LINE__)
725 
726 #define BMScreateBufferMemory(fac,init,clean) BMScreateBufferMemory_call((fac), (init), (clean), __FILE__, __LINE__)
727 #define BMSdestroyBufferMemory(mem) BMSdestroyBufferMemory_call((mem), __FILE__, __LINE__)
728 
729 
730 /** creates memory buffer storage */
733  double arraygrowfac, /**< memory growing factor for dynamically allocated arrays */
734  int arraygrowinit, /**< initial size of dynamically allocated arrays */
735  unsigned int clean, /**< should the memory blocks in the buffer be initialized to zero? */
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 /** destroys buffer memory */
743  BMS_BUFMEM** buffer, /**< pointer to memory buffer storage */
744  const char* filename, /**< source file of the function call */
745  int line /**< line number in source file of the function call */
746  );
747 
748 /** set arraygrowfac */
751  BMS_BUFMEM* buffer, /**< pointer to memory buffer storage */
752  double arraygrowfac /**< memory growing factor for dynamically allocated arrays */
753  );
754 
755 /** set arraygrowinit */
758  BMS_BUFMEM* buffer, /**< pointer to memory buffer storage */
759  int arraygrowinit /**< initial size of dynamically allocated arrays */
760  );
761 
762 /** allocates the next unused buffer */
765  BMS_BUFMEM* buffer, /**< memory buffer storage */
766  size_t size, /**< minimal required size of the buffer */
767  const char* filename, /**< source file of the function call */
768  int line /**< line number in source file of the function call */
769  );
770 
771 /** allocates the next unused buffer array */
774  BMS_BUFMEM* buffer, /**< memory buffer storage */
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 clears it */
784  BMS_BUFMEM* buffer, /**< memory buffer storage */
785  size_t num, /**< size of array to be allocated */
786  size_t typesize, /**< size of components */
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 /** reallocates the buffer to at least the given size */
794  BMS_BUFMEM* buffer, /**< memory buffer storage */
795  void* ptr, /**< pointer to the allocated memory buffer */
796  size_t size, /**< minimal required size of the buffer */
797  const char* filename, /**< source file of the function call */
798  int line /**< line number in source file of the function call */
799  );
800 
801 /** reallocates an array in the buffer to at least the given size */
804  BMS_BUFMEM* buffer, /**< memory buffer storage */
805  void* ptr, /**< pointer to the allocated memory buffer */
806  size_t num, /**< size of array to be allocated */
807  size_t typesize, /**< size of components */
808  const char* filename, /**< source file of the function call */
809  int line /**< line number in source file of the function call */
810  );
811 
812 /** allocates the next unused buffer and copies the given memory into the buffer */
815  BMS_BUFMEM* buffer, /**< memory buffer storage */
816  const void* source, /**< memory block to copy into the buffer */
817  size_t size, /**< minimal required size of the buffer */
818  const char* filename, /**< source file of the function call */
819  int line /**< line number in source file of the function call */
820  );
821 
822 /** allocates an array in the next unused buffer and copies the given memory into the buffer */
825  BMS_BUFMEM* buffer, /**< memory buffer storage */
826  const void* source, /**< memory block to copy into the buffer */
827  size_t num, /**< size of array to be allocated */
828  size_t typesize, /**< size of components */
829  const char* filename, /**< source file of the function call */
830  int line /**< line number in source file of the function call */
831  );
832 
833 /** frees a buffer and sets pointer to NULL */
836  BMS_BUFMEM* buffer, /**< memory buffer storage */
837  void** ptr, /**< pointer to pointer to the allocated memory buffer */
838  const char* filename, /**< source file of the function call */
839  int line /**< line number in source file of the function call */
840  );
841 
842 /** frees a buffer if pointer is not NULL and sets pointer to NULL */
845  BMS_BUFMEM* buffer, /**< memory buffer storage */
846  void** ptr, /**< pointer to pointer to the allocated memory buffer */
847  const char* filename, /**< source file of the function call */
848  int line /**< line number in source file of the function call */
849  );
850 
851 /** gets number of used buffers */
854  BMS_BUFMEM* buffer /**< memory buffer storage */
855  );
856 
857 /** returns the number of allocated bytes in the buffer memory */
859 long long BMSgetBufferMemoryUsed(
860  const BMS_BUFMEM* bufmem /**< buffer memory */
861  );
862 
863 /** outputs statistics about currently allocated buffers to the screen */
866  BMS_BUFMEM* buffer /**< memory buffer storage */
867  );
868 
869 
870 #ifdef __cplusplus
871 }
872 #endif
873 
874 #endif
SCIP_EXPORT void * BMSreallocMemory_call(void *ptr, size_t size, const char *filename, int line)
Definition: memory.c:450
SCIP_EXPORT void * BMSduplicateBufferMemory_call(BMS_BUFMEM *buffer, const void *source, size_t size, const char *filename, int line)
Definition: memory.c:2928
SCIP_EXPORT void BMSprintBufferMemory(BMS_BUFMEM *buffer)
Definition: memory.c:3118
SCIP_EXPORT void * BMSallocBufferMemory_call(BMS_BUFMEM *buffer, size_t size, const char *filename, int line)
Definition: memory.c:2753
SCIP_EXPORT void * BMSduplicateChunkMemory_call(BMS_CHKMEM *chkmem, const void *source, size_t size, const char *filename, int line)
Definition: memory.c:1539
struct BMS_ChkMem BMS_CHKMEM
Definition: memory.h:292
SCIP_EXPORT void BMSdestroyBlockMemory_call(BMS_BLKMEM **blkmem, const char *filename, int line)
Definition: memory.c:1790
SCIP_EXPORT long long BMScheckEmptyBlockMemory_call(const BMS_BLKMEM *blkmem)
Definition: memory.c:2385
SCIP_EXPORT BMS_BUFMEM * BMScreateBufferMemory_call(double arraygrowfac, int arraygrowinit, unsigned int clean, const char *filename, int line)
Definition: memory.c:2479
SCIP_EXPORT long long BMSgetBufferMemoryUsed(const BMS_BUFMEM *bufmem)
Definition: memory.c:3100
SCIP_EXPORT void BMSfreeChunkMemoryNull_call(BMS_CHKMEM *chkmem, void **ptr, size_t size, const char *filename, int line)
Definition: memory.c:1590
double arraygrowfac
Definition: memory.c:2473
SCIP_EXPORT void BMSsetBufferMemoryArraygrowinit(BMS_BUFMEM *buffer, int arraygrowinit)
Definition: memory.c:2560
SCIP_EXPORT void BMSclearChunkMemory_call(BMS_CHKMEM *chkmem, const char *filename, int line)
Definition: memory.c:1474
size_t * size
Definition: memory.c:2467
SCIP_EXPORT void BMSgarbagecollectChunkMemory_call(BMS_CHKMEM *chkmem)
Definition: memory.c:1614
SCIP_EXPORT void * BMSreallocBlockMemory_call(BMS_BLKMEM *blkmem, void *ptr, size_t oldsize, size_t newsize, const char *filename, int line)
Definition: memory.c:1935
SCIP_EXPORT void BMSfreeChunkMemory_call(BMS_CHKMEM *chkmem, void **ptr, size_t size, const char *filename, int line)
Definition: memory.c:1561
SCIP_EXPORT BMS_CHKMEM * BMScreateChunkMemory_call(size_t size, int initchunksize, int garbagefactor, const char *filename, int line)
Definition: memory.c:1450
SCIP_EXPORT void BMSfreeBufferMemoryNull_call(BMS_BUFMEM *buffer, void **ptr, const char *filename, int line)
Definition: memory.c:3070
SCIP_EXPORT void BMSfreeBlockMemory_call(BMS_BLKMEM *blkmem, void **ptr, size_t size, const char *filename, int line)
Definition: memory.c:2104
SCIP_EXPORT void * BMSreallocBufferMemoryArray_call(BMS_BUFMEM *buffer, void *ptr, size_t num, size_t typesize, const char *filename, int line)
Definition: memory.c:2906
SCIP_EXPORT void * BMSduplicateMemoryArray_call(const void *source, size_t num, size_t typesize, const char *filename, int line)
Definition: memory.c:589
SCIP_EXPORT void * BMSallocClearMemory_call(size_t num, size_t typesize, const char *filename, int line)
Definition: memory.c:339
SCIP_EXPORT long long BMSgetBlockMemoryUnusedMax_call(const BMS_BLKMEM *blkmem)
Definition: memory.c:2221
SCIP_EXPORT void * BMSallocClearBufferMemoryArray_call(BMS_BUFMEM *buffer, size_t num, size_t typesize, const char *filename, int line)
Definition: memory.c:2794
SCIP_EXPORT void * BMSreallocMemoryArray_call(void *ptr, size_t num, size_t typesize, const char *filename, int line)
Definition: memory.c:486
SCIP_EXPORT void * BMSduplicateBlockMemory_call(BMS_BLKMEM *blkmem, const void *source, size_t size, const char *filename, int line)
Definition: memory.c:2014
#define SCIP_EXPORT
Definition: memory.h:86
SCIP_EXPORT void BMSfreeMemory_call(void **ptr, const char *filename, int line)
Definition: memory.c:609
SCIP_EXPORT void BMSgarbagecollectBlockMemory_call(BMS_BLKMEM *blkmem)
Definition: memory.c:2147
SCIP_EXPORT void BMSalignMemsize(size_t *size)
Definition: memory.c:757
SCIP_EXPORT void * BMSallocBlockMemoryArray_call(BMS_BLKMEM *blkmem, size_t num, size_t typesize, const char *filename, int line)
Definition: memory.c:1896
SCIP_EXPORT void * BMSallocMemory_call(size_t size, const char *filename, int line)
Definition: memory.c:378
SCIP_EXPORT void * BMSduplicateMemory_call(const void *source, size_t size, const char *filename, int line)
Definition: memory.c:570
SCIP_EXPORT long long BMSgetBlockMemoryUnused_call(const BMS_BLKMEM *blkmem)
Definition: memory.c:2201
SCIP_EXPORT void * BMSallocChunkMemory_call(BMS_CHKMEM *chkmem, size_t size, const char *filename, int line)
Definition: memory.c:1512
SCIP_EXPORT int BMSisAligned(size_t size)
Definition: memory.c:766
SCIP_EXPORT long long BMSgetMemoryUsed_call(void)
Definition: memory.c:329
SCIP_EXPORT void BMSdisplayMemory_call(void)
Definition: memory.c:314
SCIP_EXPORT void BMScopyMemory_call(void *ptr, const void *source, size_t size)
Definition: memory.c:538
long long BMSgetBlockMemoryAllocatedMax_call(const BMS_BLKMEM *blkmem)
Definition: memory.c:2231
SCIP_EXPORT size_t BMSgetNUsedBufferMemory(BMS_BUFMEM *buffer)
Definition: memory.c:3090
SCIP_EXPORT void BMSdestroyBufferMemory_call(BMS_BUFMEM **buffer, const char *filename, int line)
Definition: memory.c:2515
SCIP_EXPORT long long BMSgetChunkMemoryUsed_call(const BMS_CHKMEM *chkmem)
Definition: memory.c:1624
SCIP_EXPORT void * BMSduplicateBufferMemoryArray_call(BMS_BUFMEM *buffer, const void *source, size_t num, size_t typesize, const char *filename, int line)
Definition: memory.c:2951
SCIP_EXPORT long long BMSgetBlockMemoryUsed_call(const BMS_BLKMEM *blkmem)
Definition: memory.c:2191
SCIP_EXPORT void BMSfreeBlockMemoryNull_call(BMS_BLKMEM *blkmem, void **ptr, size_t size, const char *filename, int line)
Definition: memory.c:2126
SCIP_EXPORT size_t BMSgetPointerSize_call(const void *ptr)
Definition: memory.c:305
SCIP_EXPORT void * BMSallocMemoryArray_call(size_t num, size_t typesize, const char *filename, int line)
Definition: memory.c:412
unsigned int arraygrowinit
Definition: memory.c:2474
SCIP_EXPORT void * BMSallocBufferMemoryArray_call(BMS_BUFMEM *buffer, size_t num, size_t typesize, const char *filename, int line)
Definition: memory.c:2773
SCIP_EXPORT void BMSmoveMemory_call(void *ptr, const void *source, size_t size)
Definition: memory.c:555
SCIP_EXPORT void BMSsetBufferMemoryArraygrowfac(BMS_BUFMEM *buffer, double arraygrowfac)
Definition: memory.c:2548
SCIP_EXPORT BMS_BLKMEM * BMScreateBlockMemory_call(int initchunksize, int garbagefactor, const char *filename, int line)
Definition: memory.c:1722
SCIP_EXPORT void BMScheckEmptyMemory_call(void)
Definition: memory.c:322
SCIP_EXPORT void BMSfreeMemoryNull_call(void **ptr, const char *filename, int line)
Definition: memory.c:631
SCIP_EXPORT 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:1975
SCIP_EXPORT void * BMSallocClearBlockMemoryArray_call(BMS_BLKMEM *blkmem, size_t num, size_t typesize, const char *filename, int line)
Definition: memory.c:1917
SCIP_EXPORT long long BMSgetBlockMemoryUsedMax_call(const BMS_BLKMEM *blkmem)
Definition: memory.c:2211
SCIP_EXPORT void BMSfreeBufferMemory_call(BMS_BUFMEM *buffer, void **ptr, const char *filename, int line)
Definition: memory.c:3047
SCIP_EXPORT void BMSclearMemory_call(void *ptr, size_t size)
Definition: memory.c:525
SCIP_EXPORT void * BMSallocBlockMemory_call(BMS_BLKMEM *blkmem, size_t size, const char *filename, int line)
Definition: memory.c:1876
struct BMS_BlkMem BMS_BLKMEM
Definition: memory.h:427
SCIP_EXPORT void BMSdisplayBlockMemory_call(const BMS_BLKMEM *blkmem)
Definition: memory.c:2261
unsigned int clean
Definition: memory.c:2470
SCIP_EXPORT void BMSdestroyChunkMemory_call(BMS_CHKMEM **chkmem, const char *filename, int line)
Definition: memory.c:1492
SCIP_EXPORT size_t BMSgetBlockPointerSize_call(const BMS_BLKMEM *blkmem, const void *ptr)
Definition: memory.c:2241
SCIP_EXPORT void * BMSduplicateBlockMemoryArray_call(BMS_BLKMEM *blkmem, const void *source, size_t num, size_t typesize, const char *filename, int line)
Definition: memory.c:2034
SCIP_EXPORT void BMSclearBlockMemory_call(BMS_BLKMEM *blkmem, const char *filename, int line)
Definition: memory.c:1756
SCIP_EXPORT long long BMSgetBlockMemoryAllocated_call(const BMS_BLKMEM *blkmem)
Definition: memory.c:2181
SCIP_EXPORT void * BMSreallocBufferMemory_call(BMS_BUFMEM *buffer, void *ptr, size_t size, const char *filename, int line)
Definition: memory.c:2885