jnthn / p6-app-moarvm-heapanalyzer

An analyzer for MoarVM heap snapshots
5 stars 5 forks source link

Appears not to work with the current heap snapshot format #7

Open jonathanstowe opened 2 years ago

jonathanstowe commented 2 years ago

With just one snapshot in the file:

[jonathan@menenius katikati]$ raku  --profile-kind=heap --profile -e 'my $i = 1; say "foo"'
foo
Heap snapshot written to heap-snapshot-1659454808422141361.mvmheap
[jonathan@menenius katikati]$ moar-ha heap-snapshot-1659454808422141361.mvmheap
Considering the snapshot...looks reasonable!

This file contains 1 heap snapshot. I've selected it for you.
Type `help` for available commands, or `exit` to exit.

> An operation first awaited:
  in block  at /home/jonathan/.raku/sources/BE7D3EE380568657EBC1780EA1C0BBDFC91FA530 (App::MoarVM::HeapAnalyzer::Model) line 780

Died with the exception:
    This container does not reference a native integer
      in sub grab_n_refs_starting_at at /home/jonathan/.raku/sources/BE7D3EE380568657EBC1780EA1C0BBDFC91FA530 (App::MoarVM::HeapAnalyzer::Model) line 735
      in block  at /home/jonathan/.raku/sources/BE7D3EE380568657EBC1780EA1C0BBDFC91FA530 (App::MoarVM::HeapAnalyzer::Model) line 781

With multiple snapshots:

[jonathan@menenius katikati]$ moar-ha heap-snapshot-1659440872814540966.mvmheap
Considering the snapshot...looks reasonable!

This file contains 18 heap snapshots. To select one to look
at, type something like `snapshot 10`.
Type `help` for available commands, or `exit` to exit.

> snapshot 10
Loading that snapshot. Carry on...
> expected the references header at 0x2BEF4556, but got "\0\0\0\0" instead.
  in sub expect-header at /home/jonathan/.raku/sources/BE7D3EE380568657EBC1780EA1C0BBDFC91FA530 (App::MoarVM::HeapAnalyzer::Model) line 518
  in block  at /home/jonathan/.raku/sources/BE7D3EE380568657EBC1780EA1C0BBDFC91FA530 (App::MoarVM::HeapAnalyzer::Model) line 774

expected the collectables header at 0x29D4956E, but got "3\x[2]\x[13]\0" instead.
  in sub expect-header at /home/jonathan/.raku/sources/BE7D3EE380568657EBC1780EA1C0BBDFC91FA530 (App::MoarVM::HeapAnalyzer::Model) line 518
  in block  at /home/jonathan/.raku/sources/BE7D3EE380568657EBC1780EA1C0BBDFC91FA530 (App::MoarVM::HeapAnalyzer::Model) line 649
  in block  at /home/jonathan/.raku/sources/BE7D3EE380568657EBC1780EA1C0BBDFC91FA530 (App::MoarVM::HeapAnalyzer::Model) line 640

That's with:

Welcome to Rakudo™ v2022.07.
Implementing the Raku® Programming Language v6.d.
Built on MoarVM version 2022.07.

But this may have been present for at least a year.

ShimmerFairy commented 1 year ago

I've encountered a similar bug, the issue seems to be that the heap dumps now start with MoarHeapDumpv003, while this module is only designed to handle MoarHeapDumpv002 and version 1 heap files.