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

Function MSC_alloc_permanent

src/gpre/msc.cpp:121–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119//
120
121UCHAR* MSC_alloc_permanent(int size)
122{
123 size = FB_ALIGN(size, FB_ALIGNMENT);
124
125 if (!permanent_space || size > permanent_space->spc_remaining)
126 {
127 const int n = MAX(size, 4096);
128 gpre_space* next = (gpre_space*) gds__alloc((SLONG) (n + sizeof(gpre_space)));
129 if (!next)
130 CPR_error("virtual memory exhausted");
131#ifdef DEBUG_GDS_ALLOC
132 // For V4.0 we don't care about gpre specific memory leaks
133 gds_alloc_flag_unfreed(next);
134#endif
135 next->spc_next = permanent_space;
136 next->spc_remaining = n;
137 permanent_space = next;
138 }
139
140 permanent_space->spc_remaining -= size;
141 UCHAR* blk = (UCHAR*) permanent_space + sizeof(gpre_space) + permanent_space->spc_remaining;
142 memset(blk, 0, size);
143
144 return blk;
145}
146
147
148//____________________________________________________________

Callers 4

act_create_databaseFunction · 0.85
act_d_sectionFunction · 0.85
act_includeFunction · 0.85
mainFunction · 0.85

Calls 2

FB_ALIGNFunction · 0.85
CPR_errorFunction · 0.85

Tested by

no test coverage detected