MCPcopy Create free account
hub / github.com/dmtcp/dmtcp / _dealloc_raw

Function _dealloc_raw

jalib/jalloc.cpp:103–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101}
102
103inline void
104_dealloc_raw(void *ptr, size_t n)
105{
106# ifdef JALIB_USE_MALLOC
107 free(ptr);
108# else // ifdef JALIB_USE_MALLOC
109 if (ptr == 0 || n == 0) {
110 return;
111 }
112
113# ifdef JALLOC_DEBUG_STATS
114 for (int i = 0; i < numAllocArenas; i++) {
115 if (allocArenas[i].startAddr == ptr) {
116 allocArenas[i].startAddr = NULL;
117 allocArenas[i].endAddr = NULL;
118 break;
119 }
120 }
121# endif // #ifdef JALLOC_DEBUG_STATS
122
123 int rv = munmap(ptr, n);
124 if (rv != 0) {
125 perror("DMTCP(" __FILE__ "): _dealloc_raw: ");
126 }
127
128# endif // ifdef JALIB_USE_MALLOC
129}
130
131/* Atomically compares the word at the given 'oldValue' address with the
132 * word at the given 'dst' address. If the two words are equal, the word

Callers 1

deallocateMethod · 0.85

Calls 2

freeFunction · 0.85
munmapFunction · 0.85

Tested by

no test coverage detected