| 162 | // type T can be CompMatr, DiagMatr or FullStateDiagMatr |
| 163 | template <class T> |
| 164 | void 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 |
no test coverage detected