Arcitectus / Sanderling

APIs and libraries to read information directly from the EVE Online game client.
https://forum.botlab.org
Apache License 2.0
258 stars 117 forks source link

High memory consumption during root search #83

Closed ranc1 closed 3 months ago

ranc1 commented 1 year ago

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.

UNSC1419 commented 11 months ago

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