MCPcopy Create free account
hub / github.com/F-Stack/f-stack / mem_setup

Function mem_setup

freebsd/contrib/zlib/test/infcover.c:158–173  ·  view source on GitHub ↗

set up a controlled memory allocation space for monitoring, set the stream parameters to the controlled routines, with opaque pointing to the space */

Source from the content-addressed store, hash-verified

156/* set up a controlled memory allocation space for monitoring, set the stream
157 parameters to the controlled routines, with opaque pointing to the space */
158local void mem_setup(z_stream *strm)
159{
160 struct mem_zone *zone;
161
162 zone = malloc(sizeof(struct mem_zone));
163 assert(zone != NULL);
164 zone->first = NULL;
165 zone->total = 0;
166 zone->highwater = 0;
167 zone->limit = 0;
168 zone->notlifo = 0;
169 zone->rogue = 0;
170 strm->opaque = zone;
171 strm->zalloc = mem_alloc;
172 strm->zfree = mem_free;
173}
174
175/* set a limit on the total memory allocation, or 0 to remove the limit */
176local void mem_limit(z_stream *strm, size_t limit)

Callers 5

infFunction · 0.85
cover_supportFunction · 0.85
cover_wrapFunction · 0.85
cover_backFunction · 0.85
tryFunction · 0.85

Calls 1

mallocFunction · 0.85

Tested by

no test coverage detected