MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / ~WasmFS

Method ~WasmFS

system/lib/wasmfs/wasmfs.cpp:69–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67}
68
69WasmFS::~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.

Callers

nothing calls this directly

Calls 4

wasmfs_flushFunction · 0.85
setParentMethod · 0.80
__lsan_do_leak_checkFunction · 0.70
lockedMethod · 0.45

Tested by

no test coverage detected