Allocators Testing Added. Pull and Chunk allocators updates.

This commit is contained in:
IlushaShurupov 2023-07-07 22:11:22 +03:00
parent 4a2ab6f5d0
commit 9e5ac1e975
30 changed files with 704 additions and 701 deletions

View file

@ -9,11 +9,12 @@ using namespace tp;
CallStackCapture* tp::gCSCapture = nullptr;
void initializeCallStackCapture() {
gCSCapture = new CallStackCapture();
gCSCapture = new (malloc(sizeof(CallStackCapture))) CallStackCapture();
}
void deinitializeCallStackCapture() {
delete gCSCapture;
gCSCapture->~CallStackCapture();
free(gCSCapture);
}
ualni CallStackCapture::CallStack::getDepth() const {
@ -198,6 +199,21 @@ void CallStackCapture::platformWriteDebugSymbols(FramePointer frame, DebugSymbol
free(symbolsArray);
}
void CallStackCapture::printSnapshot(const CallStack* snapshot) {
printf("CallStack: \n");
for (auto frame : *snapshot) {
auto symbols = gCSCapture->getSymbols(frame.getFrame());
printf(" %s ----- %s:%llu\n", symbols->getFunc(), symbols->getFile(), symbols->getLine());
}
printf("\n");
}
void CallStackCapture::logLeaks() {
for (auto cs : *this) {
printSnapshot(cs.getCallStack());
}
}
#else
void CallStackCapture::platformWriteStackTrace(CallStack* stack) { stack->frames[0] = 0; }
void CallStackCapture::platformWriteDebugSymbols(FramePointer frame, DebugSymbols* out) {