Scippy

SCIP

Solving Constraint Integer Programs

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 */
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 */
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 */
66  SCIP_MEM* mem /**< pointer to block memory structure */
67  )
68 {
69  assert(mem != NULL);
70 
72 }
#define BMSgetBlockMemoryUsed(mem)
Definition: memory.h:430
SCIP_Longint SCIPmemGetUsed(SCIP_MEM *mem)
Definition: mem.c:65
#define NULL
Definition: lpi_spx.cpp:129
#define BMScreateBlockMemory(csz, gbf)
Definition: memory.h:398
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
#define SCIPdebugMessage
Definition: pub_message.h:77
#define BMSfreeMemory(ptr)
Definition: memory.h:117
methods for block memory pools and memory buffers
BMS_BLKMEM * setmem
Definition: struct_mem.h:38
SCIP_RETCODE SCIPmemCreate(SCIP_MEM **mem)
Definition: mem.c:32
BMS_BLKMEM * probmem
Definition: struct_mem.h:39
public methods for message output
SCIP_RETCODE SCIPmemFree(SCIP_MEM **mem)
Definition: mem.c:50
#define BMSallocMemory(ptr)
Definition: memory.h:92
#define SCIP_Longint
Definition: def.h:107
common defines and data types used in all packages of SCIP
#define SCIP_ALLOC(x)
Definition: def.h:269
#define BMSdestroyBlockMemory(mem)
Definition: memory.h:401