MCPcopy Create free account
hub / github.com/QuEST-Kit/QuEST / freeAllMemoryIfAnyAllocsFailed

Function freeAllMemoryIfAnyAllocsFailed

quest/src/api/matrices.cpp:164–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

162// type T can be CompMatr, DiagMatr or FullStateDiagMatr
163template <class T>
164void freeAllMemoryIfAnyAllocsFailed(T matr) {
165
166 // ascertain whether any allocs failed on any node
167 bool anyFail = didAnyLocalAllocsFail(matr);
168 if (comm_isInit())
169 anyFail = comm_isTrueOnAllNodes(anyFail);
170
171 // if so, free all heap fields
172 if (anyFail)
173 freeHeapMatrix(matr);
174}
175
176
177// type T can be CompMatr, DiagMatr or FullStateDiagMatr

Callers 1

validateMatrixAllocsFunction · 0.70

Calls 4

comm_isInitFunction · 0.85
comm_isTrueOnAllNodesFunction · 0.85
freeHeapMatrixFunction · 0.85
didAnyLocalAllocsFailFunction · 0.70

Tested by

no test coverage detected