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-2021 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 #elif defined(__GNUC__) && __GNUC__ >= 4
86 #define SCIP_EXPORT __attribute__((__visibility__("default")))
87 #else
88 #define SCIP_EXPORT
89 #endif
90 
91 #endif
92 
93 /* define if not already existing to make file independent from def.h */
94 #ifndef SCIP_UNUSED
95 #define SCIP_UNUSED(x) ((void) (x))
96 #endif
97 
98 
99 /*************************************************************************************
100  * Standard Memory Management
101  *
102  * In debug mode, these methods extend malloc() and free() by logging all currently
103  * allocated memory elements in an allocation list. This can be used as a simple leak
104  * detection.
105  *************************************************************************************/
106 
107 /* Note: values that are passed as a size_t parameter are first converted to ptrdiff_t to be sure that negative numbers
108  * are extended to the larger size. Then they are converted to size_t. Thus, negative numbers are converted to very
109  * large size_t values. This is then checked within the functions. */
110 
111 #define BMSallocMemory(ptr) ASSIGN((ptr), BMSallocMemory_call( sizeof(**(ptr)), __FILE__, __LINE__ ))
112 #define BMSallocMemorySize(ptr,size) ASSIGN((ptr), BMSallocMemory_call( (size_t)(ptrdiff_t)(size), __FILE__, __LINE__ ))
113 #define BMSallocMemoryCPP(size) BMSallocMemory_call( (size_t)(ptrdiff_t)(size), __FILE__, __LINE__ )
114 #define BMSallocClearMemorySize(ptr,size) ASSIGN((ptr), BMSallocClearMemory_call((size_t)(1), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__ ))
115 #define BMSallocMemoryArray(ptr,num) ASSIGN((ptr), BMSallocMemoryArray_call((size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__ ))
116 #define BMSallocMemoryArrayCPP(num,size) BMSallocMemoryArray_call( (size_t)(ptrdiff_t)(num), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__ )
117 #define BMSallocClearMemoryArray(ptr,num) ASSIGN((ptr), BMSallocClearMemory_call((size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__ ))
118 #define BMSreallocMemorySize(ptr,size) ASSIGN((ptr), BMSreallocMemory_call((void*)(*(ptr)), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__ ))
119 #define BMSreallocMemoryArray(ptr,num) ASSIGN((ptr), BMSreallocMemoryArray_call( *(ptr), (size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__ ))
120 
121 #define BMSclearMemory(ptr) BMSclearMemory_call( (void*)(ptr), sizeof(*(ptr)) )
122 #define BMSclearMemoryArray(ptr, num) BMSclearMemory_call( (void*)(ptr), (size_t)(ptrdiff_t)(num)*sizeof(*(ptr)) )
123 #define BMSclearMemorySize(ptr, size) BMSclearMemory_call( (void*)(ptr), (size_t)(ptrdiff_t)(size) )
124 
125 #define BMScopyMemory(ptr, source) BMScopyMemory_call( (void*)(ptr), (const void*)(source), sizeof(*(ptr)) )
126 #define BMScopyMemoryArray(ptr, source, num) BMScopyMemory_call( (void*)(ptr), (const void*)(source), (size_t)(ptrdiff_t)(num)*sizeof(*(ptr)) )
127 #define BMScopyMemorySize(ptr, source, size) BMScopyMemory_call( (void*)(ptr), (const void*)(source), (size_t)(ptrdiff_t)(size) )
128 
129 #define BMSmoveMemory(ptr, source) BMSmoveMemory_call( (void*)(ptr), (const void*)(source), sizeof(*(ptr)) )
130 #define BMSmoveMemoryArray(ptr, source, num) BMSmoveMemory_call( (void*)(ptr), (const void*)(source), (size_t)(ptrdiff_t)(num) * sizeof(*(ptr)) )
131 #define BMSmoveMemorySize(ptr, source, size) BMSmoveMemory_call( (void*)(ptr), (const void*)(source), (size_t)(ptrdiff_t)(size) )
132 
133 #define BMSduplicateMemory(ptr, source) ASSIGN((ptr), BMSduplicateMemory_call( (const void*)(source), sizeof(**(ptr)), __FILE__, __LINE__ ))
134 #define BMSduplicateMemorySize(ptr, source, size) ASSIGN((ptr), BMSduplicateMemory_call( (const void*)(source), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__ ))
135 #define BMSduplicateMemoryArray(ptr, source, num) ASSIGNCHECK((ptr), BMSduplicateMemoryArray_call( (const void*)(source), (size_t)(ptrdiff_t)(num), \
136  sizeof(**(ptr)), __FILE__, __LINE__ ), source)
137 #define BMSfreeMemory(ptr) BMSfreeMemory_call( (void**)(ptr), __FILE__, __LINE__ )
138 #define BMSfreeMemoryNull(ptr) BMSfreeMemoryNull_call( (void**)(ptr), __FILE__, __LINE__ )
139 #define BMSfreeMemoryArray(ptr) BMSfreeMemory_call( (void**)(ptr), __FILE__, __LINE__ )
140 #define BMSfreeMemoryArrayNull(ptr) BMSfreeMemoryNull_call( (void**)(ptr), __FILE__, __LINE__ )
141 #define BMSfreeMemorySize(ptr) BMSfreeMemory_call( (void**)(ptr), __FILE__, __LINE__ )
142 #define BMSfreeMemorySizeNull(ptr) BMSfreeMemoryNull_call( (void**)(ptr), __FILE__, __LINE__ )
143 
144 #ifndef NDEBUG
145 #define BMSgetPointerSize(ptr) BMSgetPointerSize_call(ptr)
146 #define BMSdisplayMemory() BMSdisplayMemory_call()
147 #define BMScheckEmptyMemory() BMScheckEmptyMemory_call()
148 #define BMSgetMemoryUsed() BMSgetMemoryUsed_call()
149 #else
150 #define BMSgetPointerSize(ptr) 0
151 #define BMSdisplayMemory() /**/
152 #define BMScheckEmptyMemory() /**/
153 #define BMSgetMemoryUsed() 0LL
154 #endif
155 
156 /** allocates array and initializes it with 0; returns NULL if memory allocation failed */
159  size_t num, /**< number of memory element to allocate */
160  size_t typesize, /**< size of memory element to allocate */
161  const char* filename, /**< source file where the allocation is performed */
162  int line /**< line number in source file where the allocation is performed */
163  );
164 
165 /** allocates memory; returns NULL if memory allocation failed */
167 void* BMSallocMemory_call(
168  size_t size, /**< size of memory element to allocate */
169  const char* filename, /**< source file where the allocation is performed */
170  int line /**< line number in source file where the allocation is performed */
171  );
172 
173 /** allocates array; returns NULL if memory allocation failed */
176  size_t num, /**< number of components of array to allocate */
177  size_t typesize, /**< size of each component */
178  const char* filename, /**< source file where the allocation is performed */
179  int line /**< line number in source file where the allocation is performed */
180  );
181 
182 /** allocates memory; returns NULL if memory allocation failed */
185  void* ptr, /**< pointer to memory to reallocate */
186  size_t size, /**< new size of memory element */
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 /** reallocates array; returns NULL if memory allocation failed */
194  void* ptr, /**< pointer to memory to reallocate */
195  size_t num, /**< number of components of array to allocate */
196  size_t typesize, /**< size of each component */
197  const char* filename, /**< source file where the reallocation is performed */
198  int line /**< line number in source file where the reallocation is performed */
199  );
200 
201 /** clears a memory element (i.e. fills it with zeros) */
204  void* ptr, /**< pointer to memory element */
205  size_t size /**< size of memory element */
206  );
207 
208 /** copies the contents of one memory element into another memory element */
210 void BMScopyMemory_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 /** moves the contents of one memory element into another memory element, should be used if both elements overlap,
217  * otherwise BMScopyMemory is faster
218  */
220 void BMSmoveMemory_call(
221  void* ptr, /**< pointer to target memory element */
222  const void* source, /**< pointer to source memory element */
223  size_t size /**< size of memory element to copy */
224  );
225 
226 /** allocates memory and copies the contents of the given memory element into the new memory element */
229  const void* source, /**< pointer to source memory element */
230  size_t size, /**< size of memory element to copy */
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 /** allocates array and copies the contents of the given source array into the new array */
238  const void* source, /**< pointer to source memory element */
239  size_t num, /**< number of components of array to allocate */
240  size_t typesize, /**< size of each component */
241  const char* filename, /**< source file where the duplication is performed */
242  int line /**< line number in source file where the duplication is performed */
243  );
244 
245 /** frees an allocated memory element and sets pointer to NULL */
247 void BMSfreeMemory_call(
248  void** ptr, /**< pointer to pointer to memory element */
249  const char* filename, /**< source file where the deallocation is performed */
250  int line /**< line number in source file where the deallocation is performed */
251  );
252 
253 /** frees an allocated memory element if pointer is not NULL and sets pointer to NULL */
256  void** ptr, /**< pointer to pointer to memory element */
257  const char* filename, /**< source file where the deallocation is performed */
258  int line /**< line number in source file where the deallocation is performed */
259  );
260 
261 /** returns the size of an allocated memory element */
264  const void* ptr /**< pointer to allocated memory */
265  );
266 
267 /** outputs information about currently allocated memory to the screen */
270  void
271  );
272 
273 /** displays a warning message on the screen, if allocated memory exists */
276  void
277  );
278 
279 /** returns total number of allocated bytes */
281 long long BMSgetMemoryUsed_call(
282  void
283  );
284 
285 
286 
287 
288 /********************************************************************
289  * Chunk Memory Management
290  *
291  * Efficient memory management for multiple objects of the same size
292  ********************************************************************/
293 
294 typedef struct BMS_ChkMem BMS_CHKMEM; /**< collection of memory chunks of the same element size */
295 
296 
297 #ifndef BMS_NOBLOCKMEM
298 
299 #define BMScreateChunkMemory(sz,isz,gbf) BMScreateChunkMemory_call( (sz), (isz), (gbf), __FILE__, __LINE__ )
300 #define BMSclearChunkMemory(mem) BMSclearChunkMemory_call( (mem), __FILE__, __LINE__ )
301 #define BMSdestroyChunkMemory(mem) BMSdestroyChunkMemory_call( (mem), __FILE__, __LINE__ )
302 
303 #define BMSallocChunkMemory(mem,ptr) ASSIGN((ptr), BMSallocChunkMemory_call((mem), sizeof(**(ptr)), __FILE__, __LINE__))
304 #define BMSduplicateChunkMemory(mem, ptr, source) ASSIGN((ptr), BMSduplicateChunkMemory_call((mem), (const void*)(source), \
305  sizeof(**(ptr)), __FILE__, __LINE__ ))
306 #define BMSfreeChunkMemory(mem,ptr) BMSfreeChunkMemory_call( (mem), (void**)(ptr), sizeof(**(ptr)), __FILE__, __LINE__ )
307 #define BMSfreeChunkMemoryNull(mem,ptr) BMSfreeChunkMemoryNull_call( (mem), (void**)(ptr), sizeof(**(ptr)), __FILE__, __LINE__ )
308 #define BMSgarbagecollectChunkMemory(mem) BMSgarbagecollectChunkMemory_call(mem)
309 #define BMSgetChunkMemoryUsed(mem) BMSgetChunkMemoryUsed_call(mem)
310 
311 #else
312 
313 /* block memory management mapped to standard memory management */
314 
315 #define BMScreateChunkMemory(sz,isz,gbf) (void*)(0x01) /* dummy to not return a NULL pointer */
316 #define BMSclearChunkMemory(mem) /**/
317 #define BMSclearChunkMemoryNull(mem) /**/
318 #define BMSdestroyChunkMemory(mem) /**/
319 #define BMSdestroyChunkMemoryNull(mem) /**/
320 #define BMSallocChunkMemory(mem,ptr) BMSallocMemory(ptr)
321 #define BMSduplicateChunkMemory(mem, ptr, source) BMSduplicateMemory(ptr,source)
322 #define BMSfreeChunkMemory(mem,ptr) BMSfreeMemory(ptr)
323 #define BMSfreeChunkMemoryNull(mem,ptr) BMSfreeMemoryNull(ptr)
324 #define BMSgarbagecollectChunkMemory(mem) /**/
325 #define BMSgetChunkMemoryUsed(mem) 0LL
326 
327 #endif
328 
329 
330 /** aligns the given byte size corresponding to the minimal alignment for chunk and block memory */
332 void BMSalignMemsize(
333  size_t* size /**< pointer to the size to align */
334  );
335 
336 /** checks whether the given size meets the alignment conditions for chunk and block memory */
338 int BMSisAligned(
339  size_t size /**< size to check for alignment */
340  );
341 
342 /** creates a new chunk block data structure */
345  size_t size, /**< element size of the chunk block */
346  int initchunksize, /**< number of elements in the first chunk of the chunk block */
347  int garbagefactor, /**< garbage collector is called, if at least garbagefactor * avg. chunksize
348  * elements are free (-1: disable garbage collection) */
349  const char* filename, /**< source file of the function call */
350  int line /**< line number in source file of the function call */
351  );
352 
353 /** clears a chunk block data structure */
356  BMS_CHKMEM* chkmem, /**< chunk block */
357  const char* filename, /**< source file of the function call */
358  int line /**< line number in source file of the function call */
359  );
360 
361 /** destroys and frees a chunk block data structure */
364  BMS_CHKMEM** chkmem, /**< pointer to chunk block */
365  const char* filename, /**< source file of the function call */
366  int line /**< line number in source file of the function call */
367  );
368 
369 /** allocates a memory element of the given chunk block */
372  BMS_CHKMEM* chkmem, /**< chunk block */
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 /** duplicates a given memory element by allocating a new element of the same chunk block and copying the data */
381  BMS_CHKMEM* chkmem, /**< chunk block */
382  const void* source, /**< source memory element */
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 and sets pointer to NULL */
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 /** frees a memory element of the given chunk block if pointer is not NULL and sets pointer to NULL */
401  BMS_CHKMEM* chkmem, /**< chunk block */
402  void** ptr, /**< pointer to pointer to memory element to free */
403  size_t size, /**< size of memory element to allocate (only needed for sanity check) */
404  const char* filename, /**< source file of the function call */
405  int line /**< line number in source file of the function call */
406  );
407 
408 /** calls garbage collection of chunk block and frees chunks without allocated memory elements */
411  BMS_CHKMEM* chkmem /**< chunk block */
412  );
413 
414 /** returns the number of allocated bytes in the chunk block */
417  const BMS_CHKMEM* chkmem /**< chunk block */
418  );
419 
420 
421 
422 
423 /***********************************************************
424  * Block Memory Management
425  *
426  * Efficient memory management for objects of varying sizes
427  ***********************************************************/
428 
429 typedef struct BMS_BlkMem BMS_BLKMEM; /**< block memory: collection of chunk blocks */
430 
431 #ifndef BMS_NOBLOCKMEM
432 
433 /* block memory methods for faster memory access */
434 
435 /* Note: values that are passed as a size_t parameter are first converted to ptrdiff_t to be sure that negative numbers
436  * are extended to the larger size. Then they are converted to size_t. Thus, negative numbers are converted to very
437  * large size_t values. This is then checked within the functions. */
438 
439 #define BMScreateBlockMemory(csz,gbf) BMScreateBlockMemory_call( (csz), (gbf), __FILE__, __LINE__ )
440 #define BMSclearBlockMemory(mem) BMSclearBlockMemory_call( (mem), __FILE__, __LINE__ )
441 #define BMSdestroyBlockMemory(mem) BMSdestroyBlockMemory_call( (mem), __FILE__, __LINE__ )
442 
443 #define BMSallocBlockMemory(mem,ptr) ASSIGN((ptr), BMSallocBlockMemory_call((mem), sizeof(**(ptr)), __FILE__, __LINE__))
444 #define BMSallocBlockMemorySize(mem,ptr,size) ASSIGN((ptr), BMSallocBlockMemory_call((mem), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__))
445 #define BMSallocBlockMemoryArray(mem,ptr,num) ASSIGN((ptr), BMSallocBlockMemoryArray_call((mem), (size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__))
446 #define BMSallocClearBlockMemoryArray(mem,ptr,num) ASSIGN((ptr), BMSallocClearBlockMemoryArray_call((mem), (size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__))
447 #define BMSreallocBlockMemorySize(mem,ptr,oldsize,newsize) ASSIGN((ptr), BMSreallocBlockMemory_call((mem), (void*)(*(ptr)), \
448  (size_t)(ptrdiff_t)(oldsize), (size_t)(ptrdiff_t)(newsize), __FILE__, __LINE__))
449 #define BMSreallocBlockMemoryArray(mem,ptr,oldnum,newnum) ASSIGN((ptr), BMSreallocBlockMemoryArray_call((mem), (void*)(*(ptr)), \
450  (size_t)(ptrdiff_t)(oldnum), (size_t)(ptrdiff_t)(newnum), sizeof(**(ptr)), __FILE__, __LINE__))
451 #define BMSduplicateBlockMemory(mem, ptr, source) ASSIGN((ptr), BMSduplicateBlockMemory_call((mem), (const void*)(source), \
452  sizeof(**(ptr)), __FILE__, __LINE__ ))
453 #define BMSduplicateBlockMemoryArray(mem, ptr, source, num) ASSIGNCHECK((ptr), BMSduplicateBlockMemoryArray_call( (mem), (const void*)(source), \
454  (size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__ ), source)
455 
456 #define BMSfreeBlockMemory(mem,ptr) BMSfreeBlockMemory_call( (mem), (void**)(ptr), sizeof(**(ptr)), __FILE__, __LINE__ )
457 #define BMSfreeBlockMemoryNull(mem,ptr) BMSfreeBlockMemoryNull_call( (mem), (void**)(ptr), sizeof(**(ptr)), __FILE__, __LINE__ )
458 #define BMSfreeBlockMemoryArray(mem,ptr,num) BMSfreeBlockMemory_call( (mem), (void**)(ptr), (num)*sizeof(**(ptr)), __FILE__, __LINE__ )
459 #define BMSfreeBlockMemoryArrayNull(mem,ptr,num) BMSfreeBlockMemoryNull_call( (mem), (void**)(ptr), (num)*sizeof(**(ptr)), __FILE__, __LINE__ )
460 #define BMSfreeBlockMemorySize(mem,ptr,size) BMSfreeBlockMemory_call( (mem), (void**)(ptr), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__ )
461 #define BMSfreeBlockMemorySizeNull(mem,ptr,size) BMSfreeBlockMemory_call( (mem), (void**)(ptr), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__ )
462 
463 #define BMSgarbagecollectBlockMemory(mem) BMSgarbagecollectBlockMemory_call(mem)
464 #define BMSgetBlockMemoryAllocated(mem) BMSgetBlockMemoryAllocated_call(mem)
465 #define BMSgetBlockMemoryUsed(mem) BMSgetBlockMemoryUsed_call(mem)
466 #define BMSgetBlockMemoryUnused(mem) BMSgetBlockMemoryUnused_call(mem)
467 #define BMSgetBlockMemoryUsedMax(mem) BMSgetBlockMemoryUsedMax_call(mem)
468 #define BMSgetBlockMemoryUnusedMax(mem) BMSgetBlockMemoryUnusedMax_call(mem)
469 #define BMSgetBlockMemoryAllocatedMax(mem) BMSgetBlockMemoryAllocatedMax_call(mem)
470 #define BMSgetBlockPointerSize(mem,ptr) BMSgetBlockPointerSize_call((mem), (ptr))
471 #define BMSdisplayBlockMemory(mem) BMSdisplayBlockMemory_call(mem)
472 #define BMSblockMemoryCheckEmpty(mem) BMScheckEmptyBlockMemory_call(mem)
473 
474 #else
475 
476 /* block memory management mapped to standard memory management */
477 
478 #define BMScreateBlockMemory(csz,gbf) (SCIP_UNUSED(csz), SCIP_UNUSED(gbf), (void*)(0x01)) /* dummy to not return a NULL pointer */
479 #define BMSclearBlockMemory(mem) SCIP_UNUSED(mem)
480 #define BMSclearBlockMemoryNull(mem) SCIP_UNUSED(mem)
481 #define BMSdestroyBlockMemory(mem) SCIP_UNUSED(mem)
482 #define BMSdestroyBlockMemoryNull(mem) SCIP_UNUSED(mem)
483 #define BMSallocBlockMemory(mem,ptr) (SCIP_UNUSED(mem), BMSallocMemory(ptr))
484 #define BMSallocBlockMemoryArray(mem,ptr,num) (SCIP_UNUSED(mem), BMSallocMemoryArray(ptr,num))
485 #define BMSallocClearBlockMemoryArray(mem,ptr,num) (SCIP_UNUSED(mem), BMSallocClearMemoryArray(ptr,num))
486 #define BMSallocBlockMemorySize(mem,ptr,size) (SCIP_UNUSED(mem), BMSallocMemorySize(ptr,size))
487 #define BMSreallocBlockMemoryArray(mem,ptr,oldnum,newnum) (SCIP_UNUSED(mem), SCIP_UNUSED(oldnum), BMSreallocMemoryArray(ptr,newnum))
488 #define BMSreallocBlockMemorySize(mem,ptr,oldsize,newsize) (SCIP_UNUSED(mem), SCIP_UNUSED(oldsize), BMSreallocMemorySize(ptr,newsize))
489 #define BMSduplicateBlockMemory(mem, ptr, source) (SCIP_UNUSED(mem), BMSduplicateMemory(ptr,source))
490 #define BMSduplicateBlockMemoryArray(mem, ptr, source, num) (SCIP_UNUSED(mem), BMSduplicateMemoryArray(ptr,source,num))
491 #define BMSfreeBlockMemory(mem,ptr) (SCIP_UNUSED(mem), BMSfreeMemory(ptr))
492 #define BMSfreeBlockMemoryNull(mem,ptr) (SCIP_UNUSED(mem), BMSfreeMemoryNull(ptr))
493 #define BMSfreeBlockMemoryArray(mem,ptr,num) (SCIP_UNUSED(mem), SCIP_UNUSED(num), BMSfreeMemoryArray(ptr))
494 #define BMSfreeBlockMemoryArrayNull(mem,ptr,num) (SCIP_UNUSED(mem), SCIP_UNUSED(num), BMSfreeMemoryArrayNull(ptr))
495 #define BMSfreeBlockMemorySize(mem,ptr,size) (SCIP_UNUSED(mem), SCIP_UNUSED(size), BMSfreeMemory(ptr))
496 #define BMSfreeBlockMemorySizeNull(mem,ptr,size) (SCIP_UNUSED(mem), SCIP_UNUSED(size), BMSfreeMemoryNull(ptr))
497 #define BMSgarbagecollectBlockMemory(mem) SCIP_UNUSED(mem)
498 #define BMSgetBlockMemoryAllocated(mem) (SCIP_UNUSED(mem), 0LL)
499 #define BMSgetBlockMemoryUsed(mem) (SCIP_UNUSED(mem), 0LL)
500 #define BMSgetBlockMemoryUnused(mem) (SCIP_UNUSED(mem), 0LL)
501 #define BMSgetBlockMemoryUsedMax(mem) (SCIP_UNUSED(mem), 0LL)
502 #define BMSgetBlockMemoryUnusedMax(mem) (SCIP_UNUSED(mem), 0LL)
503 #define BMSgetBlockMemoryAllocatedMax(mem) (SCIP_UNUSED(mem), 0LL)
504 #define BMSgetBlockPointerSize(mem,ptr) (SCIP_UNUSED(mem), SCIP_UNUSED(ptr), 0)
505 #define BMSdisplayBlockMemory(mem) SCIP_UNUSED(mem)
506 #define BMSblockMemoryCheckEmpty(mem) (SCIP_UNUSED(mem), 0LL)
507 
508 #endif
509 
510 
511 /** creates a block memory allocation data structure */
514  int initchunksize, /**< number of elements in the first chunk of each chunk block */
515  int garbagefactor, /**< garbage collector is called, if at least garbagefactor * avg. chunksize
516  * elements are free (-1: disable garbage collection) */
517  const char* filename, /**< source file of the function call */
518  int line /**< line number in source file of the function call */
519  );
520 
521 /** frees all chunk blocks in the block memory */
524  BMS_BLKMEM* blkmem, /**< block memory */
525  const char* filename, /**< source file of the function call */
526  int line /**< line number in source file of the function call */
527  );
528 
529 /** clears and deletes block memory */
532  BMS_BLKMEM** blkmem, /**< pointer to block memory */
533  const char* filename, /**< source file of the function call */
534  int line /**< line number in source file of the function call */
535  );
536 
537 /** allocates memory in the block memory pool */
540  BMS_BLKMEM* blkmem, /**< block memory */
541  size_t size, /**< size of memory element to allocate */
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 */
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 /** allocates array in the block memory pool and clears it */
559  BMS_BLKMEM* blkmem, /**< block memory */
560  size_t num, /**< size of array to be allocated */
561  size_t typesize, /**< size of each component */
562  const char* filename, /**< source file of the function call */
563  int line /**< line number in source file of the function call */
564  );
565 
566 /** resizes memory element in the block memory pool and copies the data */
569  BMS_BLKMEM* blkmem, /**< block memory */
570  void* ptr, /**< memory element to reallocated */
571  size_t oldsize, /**< old size of memory element */
572  size_t newsize, /**< new size of memory element */
573  const char* filename, /**< source file of the function call */
574  int line /**< line number in source file of the function call */
575  );
576 
577 /** resizes array in the block memory pool and copies the data */
580  BMS_BLKMEM* blkmem, /**< block memory */
581  void* ptr, /**< memory element to reallocated */
582  size_t oldnum, /**< old size of array */
583  size_t newnum, /**< new size of array */
584  size_t typesize, /**< size of each component */
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 memory element in the block memory pool and copies the data */
592  BMS_BLKMEM* blkmem, /**< block memory */
593  const void* source, /**< memory element to duplicate */
594  size_t size, /**< size of memory elements */
595  const char* filename, /**< source file of the function call */
596  int line /**< line number in source file of the function call */
597  );
598 
599 /** duplicates array in the block memory pool and copies the data */
602  BMS_BLKMEM* blkmem, /**< block memory */
603  const void* source, /**< memory element to duplicate */
604  size_t num, /**< size of array to be duplicated */
605  size_t typesize, /**< size of each component */
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 and sets pointer to NULL */
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 /** frees memory element in the block memory pool if pointer is not NULL and sets pointer to NULL */
623  BMS_BLKMEM* blkmem, /**< block memory */
624  void** ptr, /**< pointer to pointer to memory element to free */
625  size_t size, /**< size of memory element */
626  const char* filename, /**< source file of the function call */
627  int line /**< line number in source file of the function call */
628  );
629 
630 /** calls garbage collection of block memory, frees chunks without allocated memory elements, and frees
631  * chunk blocks without any chunks
632  */
635  BMS_BLKMEM* blkmem /**< block memory */
636  );
637 
638 /** returns the number of allocated bytes in the block memory */
641  const BMS_BLKMEM* blkmem /**< block memory */
642  );
643 
644 /** returns the number of used bytes in the block memory */
647  const BMS_BLKMEM* blkmem /**< block memory */
648  );
649 
650 /** returns the number of allocated but not used bytes in the block memory */
653  const BMS_BLKMEM* blkmem /**< block memory */
654  );
655 
656 /** returns the maximal number of used bytes in the block memory */
659  const BMS_BLKMEM* blkmem /**< block memory */
660  );
661 
662 /** returns the maximal number of allocated but not used bytes in the block memory */
665  const BMS_BLKMEM* blkmem /**< block memory */
666  );
667 
668 /** returns the maximal number of allocated bytes in the block memory */
670  const BMS_BLKMEM* blkmem /**< block memory */
671  );
672 
673 /** returns the size of the given memory element; returns 0, if the element is not member of the block memory */
676  const BMS_BLKMEM* blkmem, /**< block memory */
677  const void* ptr /**< memory element */
678  );
679 
680 /** outputs allocation diagnostics of block memory */
683  const BMS_BLKMEM* blkmem /**< block memory */
684  );
685 
686 /** outputs error messages, if there are allocated elements in the block memory and returns number of unfreed bytes */
689  const BMS_BLKMEM* blkmem /**< block memory */
690  );
691 
692 
693 
694 
695 
696 /***********************************************************
697  * Buffer Memory Management
698  *
699  * Efficient memory management for temporary objects
700  ***********************************************************/
701 
702 typedef struct BMS_BufMem BMS_BUFMEM; /**< buffer memory for temporary objects */
703 
704 /* Note: values that are passed as a size_t parameter are first converted to ptrdiff_t to be sure that negative numbers
705  * are extended to the larger size. Then they are converted to size_t. Thus, negative numbers are converted to very
706  * large size_t values. This is then checked within the functions. */
707 
708 #define BMSallocBufferMemory(mem,ptr) ASSIGN((ptr), BMSallocBufferMemory_call((mem), sizeof(**(ptr)), __FILE__, __LINE__))
709 #define BMSallocBufferMemorySize(mem,ptr,size) ASSIGN((ptr), BMSallocBufferMemory_call((mem), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__))
710 #define BMSreallocBufferMemorySize(mem,ptr,size) \
711  ASSIGN((ptr), BMSreallocBufferMemory_call((mem), (void*)(*(ptr)), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__))
712 #define BMSallocBufferMemoryArray(mem,ptr,num) ASSIGN((ptr), BMSallocBufferMemoryArray_call((mem), (size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__))
713 #define BMSallocClearBufferMemoryArray(mem,ptr,num) ASSIGN((ptr), BMSallocClearBufferMemoryArray_call((mem), (size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__))
714 #define BMSreallocBufferMemoryArray(mem,ptr,num) ASSIGN((ptr), BMSreallocBufferMemoryArray_call((mem), (void*)(*(ptr)), (size_t)(ptrdiff_t)(num), \
715  sizeof(**(ptr)), __FILE__, __LINE__))
716 #define BMSduplicateBufferMemory(mem,ptr,source,size) \
717  ASSIGN((ptr), BMSduplicateBufferMemory_call((mem), (const void*)(source), (size_t)(ptrdiff_t)(size), __FILE__, __LINE__))
718 #define BMSduplicateBufferMemoryArray(mem,ptr,source,num) ASSIGNCHECK((ptr), BMSduplicateBufferMemoryArray_call((mem), \
719  (const void*)(source), (size_t)(ptrdiff_t)(num), sizeof(**(ptr)), __FILE__, __LINE__), source)
720 
721 #define BMSfreeBufferMemory(mem,ptr) BMSfreeBufferMemory_call((mem), (void**)(ptr), __FILE__, __LINE__)
722 #define BMSfreeBufferMemoryNull(mem,ptr) BMSfreeBufferMemoryNull_call((mem), (void**)(ptr), __FILE__, __LINE__)
723 #define BMSfreeBufferMemoryArray(mem,ptr) BMSfreeBufferMemory_call((mem), (void**)(ptr), __FILE__, __LINE__)
724 #define BMSfreeBufferMemoryArrayNull(mem,ptr) BMSfreeBufferMemoryNull_call((mem), (void**)(ptr), __FILE__, __LINE__)
725 #define BMSfreeBufferMemorySize(mem,ptr) BMSfreeBufferMemory_call((mem), (void**)(ptr), __FILE__, __LINE__);
726 #define BMSfreeBufferMemorySizeNull(mem,ptr) BMSfreeBufferMemoryNull_call((mem), (void**)(ptr), __FILE__, __LINE__)
727 
728 #define BMScreateBufferMemory(fac,init,clean) BMScreateBufferMemory_call((fac), (init), (clean), __FILE__, __LINE__)
729 #define BMSdestroyBufferMemory(mem) BMSdestroyBufferMemory_call((mem), __FILE__, __LINE__)
730 
731 
732 /** creates memory buffer storage */
735  double arraygrowfac, /**< memory growing factor for dynamically allocated arrays */
736  int arraygrowinit, /**< initial size of dynamically allocated arrays */
737  unsigned int clean, /**< should the memory blocks in the buffer be initialized to zero? */
738  const char* filename, /**< source file of the function call */
739  int line /**< line number in source file of the function call */
740  );
741 
742 /** destroys buffer memory */
745  BMS_BUFMEM** buffer, /**< pointer to memory buffer storage */
746  const char* filename, /**< source file of the function call */
747  int line /**< line number in source file of the function call */
748  );
749 
750 /** set arraygrowfac */
753  BMS_BUFMEM* buffer, /**< pointer to memory buffer storage */
754  double arraygrowfac /**< memory growing factor for dynamically allocated arrays */
755  );
756 
757 /** set arraygrowinit */
760  BMS_BUFMEM* buffer, /**< pointer to memory buffer storage */
761  int arraygrowinit /**< initial size of dynamically allocated arrays */
762  );
763 
764 /** allocates the next unused buffer */
767  BMS_BUFMEM* buffer, /**< memory buffer storage */
768  size_t size, /**< minimal required size of the buffer */
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 array */
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 /** allocates the next unused buffer and clears it */
786  BMS_BUFMEM* buffer, /**< memory buffer storage */
787  size_t num, /**< size of array to be allocated */
788  size_t typesize, /**< size of components */
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 the buffer to at least the given size */
796  BMS_BUFMEM* buffer, /**< memory buffer storage */
797  void* ptr, /**< pointer to the allocated memory buffer */
798  size_t size, /**< minimal required size of the buffer */
799  const char* filename, /**< source file of the function call */
800  int line /**< line number in source file of the function call */
801  );
802 
803 /** reallocates an array in the buffer to at least the given size */
806  BMS_BUFMEM* buffer, /**< memory buffer storage */
807  void* ptr, /**< pointer to the allocated memory buffer */
808  size_t num, /**< size of array to be allocated */
809  size_t typesize, /**< size of components */
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 the next unused buffer and copies the given memory into the buffer */
817  BMS_BUFMEM* buffer, /**< memory buffer storage */
818  const void* source, /**< memory block to copy into the buffer */
819  size_t size, /**< minimal required size of the buffer */
820  const char* filename, /**< source file of the function call */
821  int line /**< line number in source file of the function call */
822  );
823 
824 /** allocates an array in the next unused buffer and copies the given memory into the buffer */
827  BMS_BUFMEM* buffer, /**< memory buffer storage */
828  const void* source, /**< memory block to copy into the buffer */
829  size_t num, /**< size of array to be allocated */
830  size_t typesize, /**< size of components */
831  const char* filename, /**< source file of the function call */
832  int line /**< line number in source file of the function call */
833  );
834 
835 /** frees a buffer and sets pointer to NULL */
838  BMS_BUFMEM* buffer, /**< memory buffer storage */
839  void** ptr, /**< pointer to pointer to the allocated memory buffer */
840  const char* filename, /**< source file of the function call */
841  int line /**< line number in source file of the function call */
842  );
843 
844 /** frees a buffer if pointer is not NULL and sets pointer to NULL */
847  BMS_BUFMEM* buffer, /**< memory buffer storage */
848  void** ptr, /**< pointer to pointer to the allocated memory buffer */
849  const char* filename, /**< source file of the function call */
850  int line /**< line number in source file of the function call */
851  );
852 
853 /** gets number of used buffers */
856  BMS_BUFMEM* buffer /**< memory buffer storage */
857  );
858 
859 /** returns the number of allocated bytes in the buffer memory */
861 long long BMSgetBufferMemoryUsed(
862  const BMS_BUFMEM* bufmem /**< buffer memory */
863  );
864 
865 /** outputs statistics about currently allocated buffers to the screen */
868  BMS_BUFMEM* buffer /**< memory buffer storage */
869  );
870 
871 
872 #ifdef __cplusplus
873 }
874 #endif
875 
876 #endif
SCIP_EXPORT void * BMSreallocMemory_call(void *ptr, size_t size, const char *filename, int line)
Definition: memory.c:454
SCIP_EXPORT void * BMSduplicateBufferMemory_call(BMS_BUFMEM *buffer, const void *source, size_t size, const char *filename, int line)
Definition: memory.c:2934
SCIP_EXPORT void BMSprintBufferMemory(BMS_BUFMEM *buffer)
Definition: memory.c:3124
SCIP_EXPORT void * BMSallocBufferMemory_call(BMS_BUFMEM *buffer, size_t size, const char *filename, int line)
Definition: memory.c:2759
SCIP_EXPORT void * BMSduplicateChunkMemory_call(BMS_CHKMEM *chkmem, const void *source, size_t size, const char *filename, int line)
Definition: memory.c:1545
struct BMS_ChkMem BMS_CHKMEM
Definition: memory.h:294
SCIP_EXPORT void BMSdestroyBlockMemory_call(BMS_BLKMEM **blkmem, const char *filename, int line)
Definition: memory.c:1796
SCIP_EXPORT long long BMScheckEmptyBlockMemory_call(const BMS_BLKMEM *blkmem)
Definition: memory.c:2391
SCIP_EXPORT BMS_BUFMEM * BMScreateBufferMemory_call(double arraygrowfac, int arraygrowinit, unsigned int clean, const char *filename, int line)
Definition: memory.c:2485
SCIP_EXPORT long long BMSgetBufferMemoryUsed(const BMS_BUFMEM *bufmem)
Definition: memory.c:3106
SCIP_EXPORT void BMSfreeChunkMemoryNull_call(BMS_CHKMEM *chkmem, void **ptr, size_t size, const char *filename, int line)
Definition: memory.c:1596
double arraygrowfac
Definition: memory.c:2479
SCIP_EXPORT void BMSsetBufferMemoryArraygrowinit(BMS_BUFMEM *buffer, int arraygrowinit)
Definition: memory.c:2566
SCIP_EXPORT void BMSclearChunkMemory_call(BMS_CHKMEM *chkmem, const char *filename, int line)
Definition: memory.c:1480
size_t * size
Definition: memory.c:2473
SCIP_EXPORT void BMSgarbagecollectChunkMemory_call(BMS_CHKMEM *chkmem)
Definition: memory.c:1620
SCIP_EXPORT void * BMSreallocBlockMemory_call(BMS_BLKMEM *blkmem, void *ptr, size_t oldsize, size_t newsize, const char *filename, int line)
Definition: memory.c:1941
SCIP_EXPORT void BMSfreeChunkMemory_call(BMS_CHKMEM *chkmem, void **ptr, size_t size, const char *filename, int line)
Definition: memory.c:1567
SCIP_EXPORT BMS_CHKMEM * BMScreateChunkMemory_call(size_t size, int initchunksize, int garbagefactor, const char *filename, int line)
Definition: memory.c:1456
SCIP_EXPORT void BMSfreeBufferMemoryNull_call(BMS_BUFMEM *buffer, void **ptr, const char *filename, int line)
Definition: memory.c:3076
SCIP_EXPORT void BMSfreeBlockMemory_call(BMS_BLKMEM *blkmem, void **ptr, size_t size, const char *filename, int line)
Definition: memory.c:2110
SCIP_EXPORT void * BMSreallocBufferMemoryArray_call(BMS_BUFMEM *buffer, void *ptr, size_t num, size_t typesize, const char *filename, int line)
Definition: memory.c:2912
SCIP_EXPORT void * BMSduplicateMemoryArray_call(const void *source, size_t num, size_t typesize, const char *filename, int line)
Definition: memory.c:593
SCIP_EXPORT void * BMSallocClearMemory_call(size_t num, size_t typesize, const char *filename, int line)
Definition: memory.c:343
SCIP_EXPORT long long BMSgetBlockMemoryUnusedMax_call(const BMS_BLKMEM *blkmem)
Definition: memory.c:2227
SCIP_EXPORT void * BMSallocClearBufferMemoryArray_call(BMS_BUFMEM *buffer, size_t num, size_t typesize, const char *filename, int line)
Definition: memory.c:2800
SCIP_EXPORT void * BMSreallocMemoryArray_call(void *ptr, size_t num, size_t typesize, const char *filename, int line)
Definition: memory.c:490
SCIP_EXPORT void * BMSduplicateBlockMemory_call(BMS_BLKMEM *blkmem, const void *source, size_t size, const char *filename, int line)
Definition: memory.c:2020
#define SCIP_EXPORT
Definition: memory.h:88
SCIP_EXPORT void BMSfreeMemory_call(void **ptr, const char *filename, int line)
Definition: memory.c:613
SCIP_EXPORT void BMSgarbagecollectBlockMemory_call(BMS_BLKMEM *blkmem)
Definition: memory.c:2153
SCIP_EXPORT void BMSalignMemsize(size_t *size)
Definition: memory.c:761
SCIP_EXPORT void * BMSallocBlockMemoryArray_call(BMS_BLKMEM *blkmem, size_t num, size_t typesize, const char *filename, int line)
Definition: memory.c:1902
SCIP_EXPORT void * BMSallocMemory_call(size_t size, const char *filename, int line)
Definition: memory.c:382
SCIP_EXPORT void * BMSduplicateMemory_call(const void *source, size_t size, const char *filename, int line)
Definition: memory.c:574
SCIP_EXPORT long long BMSgetBlockMemoryUnused_call(const BMS_BLKMEM *blkmem)
Definition: memory.c:2207
SCIP_EXPORT void * BMSallocChunkMemory_call(BMS_CHKMEM *chkmem, size_t size, const char *filename, int line)
Definition: memory.c:1518
SCIP_EXPORT int BMSisAligned(size_t size)
Definition: memory.c:770
SCIP_EXPORT long long BMSgetMemoryUsed_call(void)
Definition: memory.c:333
SCIP_EXPORT void BMSdisplayMemory_call(void)
Definition: memory.c:318
SCIP_EXPORT void BMScopyMemory_call(void *ptr, const void *source, size_t size)
Definition: memory.c:542
long long BMSgetBlockMemoryAllocatedMax_call(const BMS_BLKMEM *blkmem)
Definition: memory.c:2237
SCIP_EXPORT size_t BMSgetNUsedBufferMemory(BMS_BUFMEM *buffer)
Definition: memory.c:3096
SCIP_EXPORT void BMSdestroyBufferMemory_call(BMS_BUFMEM **buffer, const char *filename, int line)
Definition: memory.c:2521
SCIP_EXPORT long long BMSgetChunkMemoryUsed_call(const BMS_CHKMEM *chkmem)
Definition: memory.c:1630
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:2957
SCIP_EXPORT long long BMSgetBlockMemoryUsed_call(const BMS_BLKMEM *blkmem)
Definition: memory.c:2197
SCIP_EXPORT void BMSfreeBlockMemoryNull_call(BMS_BLKMEM *blkmem, void **ptr, size_t size, const char *filename, int line)
Definition: memory.c:2132
SCIP_EXPORT size_t BMSgetPointerSize_call(const void *ptr)
Definition: memory.c:309
SCIP_EXPORT void * BMSallocMemoryArray_call(size_t num, size_t typesize, const char *filename, int line)
Definition: memory.c:416
unsigned int arraygrowinit
Definition: memory.c:2480
SCIP_EXPORT void * BMSallocBufferMemoryArray_call(BMS_BUFMEM *buffer, size_t num, size_t typesize, const char *filename, int line)
Definition: memory.c:2779
SCIP_EXPORT void BMSmoveMemory_call(void *ptr, const void *source, size_t size)
Definition: memory.c:559
SCIP_EXPORT void BMSsetBufferMemoryArraygrowfac(BMS_BUFMEM *buffer, double arraygrowfac)
Definition: memory.c:2554
SCIP_EXPORT BMS_BLKMEM * BMScreateBlockMemory_call(int initchunksize, int garbagefactor, const char *filename, int line)
Definition: memory.c:1728
SCIP_EXPORT void BMScheckEmptyMemory_call(void)
Definition: memory.c:326
SCIP_EXPORT void BMSfreeMemoryNull_call(void **ptr, const char *filename, int line)
Definition: memory.c:635
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:1981
SCIP_EXPORT void * BMSallocClearBlockMemoryArray_call(BMS_BLKMEM *blkmem, size_t num, size_t typesize, const char *filename, int line)
Definition: memory.c:1923
SCIP_EXPORT long long BMSgetBlockMemoryUsedMax_call(const BMS_BLKMEM *blkmem)
Definition: memory.c:2217
SCIP_EXPORT void BMSfreeBufferMemory_call(BMS_BUFMEM *buffer, void **ptr, const char *filename, int line)
Definition: memory.c:3053
SCIP_EXPORT void BMSclearMemory_call(void *ptr, size_t size)
Definition: memory.c:529
SCIP_EXPORT void * BMSallocBlockMemory_call(BMS_BLKMEM *blkmem, size_t size, const char *filename, int line)
Definition: memory.c:1882
struct BMS_BlkMem BMS_BLKMEM
Definition: memory.h:429
SCIP_EXPORT void BMSdisplayBlockMemory_call(const BMS_BLKMEM *blkmem)
Definition: memory.c:2267
unsigned int clean
Definition: memory.c:2476
SCIP_EXPORT void BMSdestroyChunkMemory_call(BMS_CHKMEM **chkmem, const char *filename, int line)
Definition: memory.c:1498
SCIP_EXPORT size_t BMSgetBlockPointerSize_call(const BMS_BLKMEM *blkmem, const void *ptr)
Definition: memory.c:2247
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:2040
SCIP_EXPORT void BMSclearBlockMemory_call(BMS_BLKMEM *blkmem, const char *filename, int line)
Definition: memory.c:1762
SCIP_EXPORT long long BMSgetBlockMemoryAllocated_call(const BMS_BLKMEM *blkmem)
Definition: memory.c:2187
SCIP_EXPORT void * BMSreallocBufferMemory_call(BMS_BUFMEM *buffer, void *ptr, size_t size, const char *filename, int line)
Definition: memory.c:2891