| 67 | } |
| 68 | |
| 69 | WasmFS::~WasmFS() { |
| 70 | // See comment above on this function. |
| 71 | // |
| 72 | // Note that it is ok for us to call it here, as LSan internally makes all |
| 73 | // calls after the first into no-ops. That is, calling it here makes the one |
| 74 | // time that leak checks are run be done here, or potentially earlier, but not |
| 75 | // later; and as mentioned in the comment above, this is the latest possible |
| 76 | // time for the checks to run (since right after this nothing can be printed). |
| 77 | __lsan_do_leak_check(); |
| 78 | |
| 79 | // TODO: Integrate musl exit() which would flush the libc part for us. That |
| 80 | // might also help with destructor priority - we need to happen last. |
| 81 | // (But we would still need to flush the internal WasmFS buffers, see |
| 82 | // wasmfs_flush() and the comment on it in the header.) |
| 83 | wasmfs_flush(); |
| 84 | |
| 85 | // Break the reference cycle caused by the root directory being its own |
| 86 | // parent. |
| 87 | rootDirectory->locked().setParent(nullptr); |
| 88 | } |
| 89 | |
| 90 | // Special backends that want to install themselves as the root use this hook. |
| 91 | // Otherwise, we use the default backends. |
nothing calls this directly
no test coverage detected