Skip to content

Binary Ninja uses too-low buffer size when reading bndb #6421

@comex

Description

@comex

Version and Platform (required):

  • Binary Ninja Version: 4.3.6879-dev (333734f4)
  • OS: macOS
  • OS Version: 15.3 (24D60)
  • CPU Architecture: Apple M3 Max

Bug Description:
One of my bndbs has grown to 11GB. I've noticed that when I open the bndb, Binary Ninja spends almost 30 seconds just calling pread to load the bndb into memory. During this time, the UI is frozen. For the pread calls, the offsets are not always sequential but often are, while the read size is always 1024 bytes.

1024 bytes seems like way too low a read size. Here is a simplistic comparison using dd (although this is sequential):

% dd if=main_301.bndb of=/dev/null bs=1024 
[..]
11609607168 bytes transferred in 13.495961 secs (860228269 bytes/sec)
% dd if=main_301.bndb of=/dev/null bs=1048576
[..]
11609607168 bytes transferred in 0.684243 secs (16967082116 bytes/sec)

(After this phase of loading is done, the UI becomes responsive again and Binary Ninja starts using CPU on multiple threads while the progress bar ticks up.)

Consider implementing some sort of cache so that you can use a larger read size… or just use mmap.

Also consider fixing the UI to not be unresponsive while reading data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: DatabaseIssue needs changes to BNDBsEffort: MediumIssue should take < 1 monthImpact: MediumIssue is impactful with a bad, or no, workaround

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions