Toggle navigation
SCIP Optimization Suite
SCIP
SoPlex
ZIMPL
UG
GCG
Documentation
SCIP 9.2.0
SCIP 8.1.0
SCIP 7.0.3
SCIP 6.0.2
SCIP 5.0.1
SCIP 4.0.1
SCIP 3.2.1
SCIP
Solving Constraint Integer Programs
Overview
Files
Plugin Types
Interfaces
Examples
How To
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
scip-repo
src
scip
mem.c
Go to the documentation of this file.
1
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2
/* */
3
/* This file is part of the program and library */
4
/* SCIP --- Solving Constraint Integer Programs */
5
/* */
6
/* Copyright (C) 2002-2014 Konrad-Zuse-Zentrum */
7
/* fuer Informationstechnik Berlin */
8
/* */
9
/* SCIP 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 SCIP; see the file COPYING. If not email to scip@zib.de. */
13
/* */
14
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15
16
/**@file mem.c
17
* @brief block memory pools and memory buffers
18
* @author Tobias Achterberg
19
*/
20
21
/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
22
23
#include <assert.h>
24
25
#include "
scip/def.h
"
26
#include "
scip/mem.h
"
27
#include "
scip/pub_message.h
"
28
29
30
31
/** creates block memory structures */
32
SCIP_RETCODE
SCIPmemCreate
(
33
SCIP_MEM
** mem
/**< pointer to block memory structure */
34
)
35
{
36
assert(mem !=
NULL
);
37
38
SCIP_ALLOC
(
BMSallocMemory
(mem) );
39
40
SCIP_ALLOC
( (*mem)->setmem =
BMScreateBlockMemory
(1, 10) );
41
SCIP_ALLOC
( (*mem)->probmem =
BMScreateBlockMemory
(1, 10) );
42
43
SCIPdebugMessage
(
"created setmem block memory at <%p>\n"
, (
void
*)(*mem)->setmem);
44
SCIPdebugMessage
(
"created probmem block memory at <%p>\n"
, (
void
*)(*mem)->probmem);
45
46
return
SCIP_OKAY
;
47
}
48
49
/** frees block memory structures */
50
SCIP_RETCODE
SCIPmemFree
(
51
SCIP_MEM
** mem
/**< pointer to block memory structure */
52
)
53
{
54
assert(mem !=
NULL
);
55
56
BMSdestroyBlockMemory
(&(*mem)->probmem);
57
BMSdestroyBlockMemory
(&(*mem)->setmem);
58
59
BMSfreeMemory
(mem);
60
61
return
SCIP_OKAY
;
62
}
63
64
/** returns the total number of bytes used in block memory */
65
SCIP_Longint
SCIPmemGetUsed
(
66
SCIP_MEM
* mem
/**< pointer to block memory structure */
67
)
68
{
69
assert(mem !=
NULL
);
70
71
return
BMSgetBlockMemoryUsed
(mem->
setmem
) +
BMSgetBlockMemoryUsed
(mem->
probmem
);
72
}
73