MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / MSC_alloc

Function MSC_alloc

src/gpre/msc.cpp:89–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87//
88
89UCHAR* MSC_alloc(int size)
90{
91 size = FB_ALIGN(size, FB_ALIGNMENT);
92
93 if (!space || size > space->spc_remaining)
94 {
95 const int n = MAX(size, 4096);
96 gpre_space* next = (gpre_space*) gds__alloc((SLONG) (n + sizeof(gpre_space)));
97 if (!next)
98 CPR_error("virtual memory exhausted");
99#ifdef DEBUG_GDS_ALLOC
100 // For V4.0 we don't care about gpre specific memory leaks
101 gds_alloc_flag_unfreed(next);
102#endif
103 next->spc_next = space;
104 next->spc_remaining = n;
105 space = next;
106 }
107
108 space->spc_remaining -= size;
109 UCHAR* blk = ((UCHAR*) space + sizeof(gpre_space) + space->spc_remaining);
110 memset(blk, 0, size);
111
112 return blk;
113}
114
115
116//____________________________________________________________

Callers 15

MSC_actionFunction · 0.85
MSC_contextFunction · 0.85
MSC_nodeFunction · 0.85
MSC_privilege_blockFunction · 0.85
MSC_pushFunction · 0.85
MSC_referenceFunction · 0.85
MSC_requestFunction · 0.85
MSC_stringFunction · 0.85
MSC_symbolFunction · 0.85
MSC_usernameFunction · 0.85
EXP_castFunction · 0.85
EXP_literalFunction · 0.85

Calls 2

FB_ALIGNFunction · 0.85
CPR_errorFunction · 0.85

Tested by

no test coverage detected