Lines Matching full:process
6 libmemunreachable is a zero-overhead native memory leak detector. It uses an imprecise mark-and-sweep garbage collector pass over all native memory, reporting any unreachable blocks as leaks. It is similar to the [Heap Checker from tcmalloc](http://htmlpreview.github.io/?https://github.com/gperftools/gperftools/blob/master/doc/heap_checker.html), but with a few key differences to remove the overhead. Instead of instrumenting every call to malloc and free, it queries the allocator (jemalloc) for active allocations when leak detection is requested. In addition, it performs a very short stop-the-world data collection on the main process, and then forks a copy of the process to perform the mark-and-sweep, minimizing disruption to the original process.
35 The sequence of steps required to perform a leak detection pass is divided into three processes - the original process, the collection process, and the sweeper process.
37 1. *Original process*: Leak detection is requested by calling `GetUnreachableMemory()`
39 3. The collection process is spawned. The collection process is similar to a normal `fork()` child process, except that it shares the address space of the parent - any writes by the original process are visible to the collection process, and vice-versa.
40 4. *Collection process*: All threads in the original process are paused with `ptrace()`.
42 6. *Original process*: Allocations are re-enabled using `malloc_enable()`, but all threads are still paused with `ptrace()`.
43 7. *Collection process*: The sweeper process is spawned using a normal `fork()`. The sweeper process has a copy of all memory from the original process, including all the data collected by the collection process.
44 8. Collection process releases all threads from `ptrace` and exits
45 9. *Original process*: All threads continue, the thread that called `GetUnreachableMemory()` blocks waiting for leak data over a pipe.
46 10. *Sweeper process*: A list of all active allocations is produced by examining the memory mappings and calling `malloc_iterate()` on any heap mappings.
49 13. Unmarked allocations are sent over the pipe back to the original process.
57 - `PtracerThread.cpp`: Used to clone the collection process with shared address space.
58 - `ThreadCapture.cpp`: Pauses threads in the main process and collects register contents.
61 - `LeakPipe.cpp`: transfers data describing leaks from the sweeper process to the original process.