Skip to content

High engine memory usage in v5.0.1 #1096

@wallys-ferreira-axur

Description

@wallys-ferreira-axur

I'm getting around 2Gb of RAM used just to start the engine in v5.0.1. Is there a way to reduce the memory usage on the engine subcommand?

If the functionalities that should be turned off to create some kind of light mode flag are known, I'd be happy to send some PRs to help creating that.

Fix attempts

I tried:

  • Reducing the MaxInstances value for the Handlers being loaded to 1, and no changes in the amount of memory used was seen.
  • Adding _mmap_size=0 and _cache_size=-2000 to database connection url.

Debugging evidence

pmap output:

000000c000000000   16384   11456   11456 rw---   [ anôn ]
00007120e17c3000   13156   12948   12948 rw---   [ anôn ]
00007120d8c3d000   44808   44808   44808 rw---   [ anôn ]
00007120c8440000   61316   61188   61188 rw---   [ anôn ]
0000000034640000  208908  208780  208780 rw---   [ anôn ]
000071206374b000 1581912 1581784 1581784 rw---   [ anôn ]
kB total         4434200 1947460 1924072

Go pprof output showing that go heap usage is tiny.

      flat  flat%   sum%        cum   cum%
    4104kB 47.07% 47.07%     4104kB 47.07%  runtime.allocm
    1028kB 11.79% 58.86%  1540.13kB 17.67%  github.com/owasp-amass/resolve/conn.(*connection).handleSingleMessage
  513.50kB  5.89% 64.75%   513.50kB  5.89%  regexp/syntax.(*compiler).inst (inline)
  512.28kB  5.88% 70.63%   512.28kB  5.88%  github.com/PuerkitoBio/purell.map.init.0
  512.25kB  5.88% 76.51%   512.25kB  5.88%  runtime.gcBgMarkWorker
  512.12kB  5.87% 82.38%   512.12kB  5.87%  internal/poll.runtime_pollSetDeadline
  512.08kB  5.87% 88.25%   512.08kB  5.87%  internal/sync.newIndirectNode[go.shape.interface {},go.shape.interface {}] (inline)
  512.05kB  5.87% 94.13%   512.05kB  5.87%  reflect.New
  512.03kB  5.87%   100%   512.03kB  5.87%  google.golang.org/protobuf/internal/impl.consumeStringSlice

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions