MCPcopy Create free account
hub / github.com/OpenNI/OpenNI / xnOSLogMemFree

Function xnOSLogMemFree

Source/OpenNI/XnOSMemoryProfiling.cpp:164–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

162}
163
164XN_C_API void xnOSLogMemFree(const void* pMemBlock)
165{
166 if (pMemBlock == NULL)
167 return;
168
169 XnMemBlockDataNode* pPrev = NULL;
170
171 XnAutoCSLocker lock(g_hCS);
172 XnMemBlockDataNode* pNode = g_allocatedMemory.pFirst;
173 while (pNode != NULL)
174 {
175 if (pNode->Data.pMemBlock == pMemBlock)
176 {
177 // found. Remove it from the list
178 if (pPrev == NULL) // no previous
179 g_allocatedMemory.pFirst = pNode->pNext;
180 else
181 pPrev->pNext = pNode->pNext;
182
183 // if it was last, update last
184 if (g_allocatedMemory.pLast == pNode)
185 g_allocatedMemory.pLast = pPrev;
186
187 xnDumpFileWriteString(g_dump, "Free,0x%x\n", pMemBlock);
188
189 // deallocate memory
190 xnOSFree(pNode);
191
192 return;
193 }
194
195 // move to next
196 pPrev = pNode;
197 pNode = pNode->pNext;
198 }
199
200 // if we got here then we're trying to free a non-allocated memory
201 XN_ASSERT(FALSE);
202}
203
204XN_C_API void xnOSWriteMemoryReport(const XnChar* csFileName)
205{

Callers 2

operator deleteFunction · 0.85
operator delete[]Function · 0.85

Calls 1

xnOSFreeFunction · 0.50

Tested by

no test coverage detected