Sanderling icon indicating copy to clipboard operation
Sanderling copied to clipboard

High memory consumption during root search

Open ranc1 opened this issue 2 years ago • 1 comments

Hello, I have observed high memory usage (>10G) during root search using the command line when the PID is provided: ./read-memory-64-bit.exe read-memory-eve-online --pid {pid} --output-file {output_file}. I believe this might be related to how the program samples the process during root search (here). I took a stab at it to improve the memory usage by changing these lines to:

if (processId.HasValue)
{
    var possibleRootAddresses = 0 < rootAddressArgument?.Length ? ImmutableList.Create(ParseULong(rootAddressArgument)) : EveOnline64.EnumeratePossibleAddressesForUIRootObjectsFromProcessId(processId.Value);

    return (new MemoryReaderFromLiveProcess(processId.Value), possibleRootAddresses);
}

it reduces the memory (<2G) as it does not "read content" when calling ReadCommittedMemoryRegionsFromProcessId. This change also sped up the root search step by a little. Also, there is no longer dependency on the screenshots, so the command does not error even when the window is not focused.

ranc1 avatar Jul 20 '23 02:07 ranc1

I recompiled according to your new code, and the memory usage has changed from 10G to 2G!! nice!

UNSC1419 avatar Aug 24 '23 01:08 UNSC1419