nnethercote / dhat-rs

Heap profiling and ad hoc profiling for Rust programs.
Apache License 2.0
744 stars 36 forks source link

Error: data file contains a repeated location (1) #29

Open hacknus opened 1 year ago

hacknus commented 1 year ago

When running dhat 0.3.2 with rustc 1.68.0 (2c8cc3432 2023-03-06) on my MacBook Pro with apple silicon and the following configuration:

#[cfg(feature = "dhat-heap")]
#[global_allocator]
static ALLOC: dhat::Alloc = dhat::Alloc;

fn main() {

    #[cfg(feature = "dhat-heap")]
        let _profiler = dhat::Profiler::new_heap();
    #[cfg(feature = "dhat-heap")]
        println!("lets profile!");
    ...
}

I get the following output:

dhat: Total:     2,197,613,072 bytes in 140,839 blocks
dhat: At t-gmax: 84,232,363 bytes in 22,743 blocks
dhat: At t-end:  4,467,522 bytes in 256 blocks
dhat: The data has been saved to dhat-heap.json, and is viewable with dhat/dh_view.html

but when trying to open the json file either in the web viewer or with with the html from the cloned repo, I get the following error: Error: data file contains a repeated location (1)

The json itself is attached. dhat-heap.json.zip

dullbananas commented 1 year ago

Another file with this issue: dhat-heap 4.zip

Code: https://github.com/LemmyNet/lemmy/tree/08e835d487b983c44ce2570d8c396d570d426916

I used cargo run with debug profile

rminderhoud commented 1 year ago

Hello, I am getting the same error. I was able to bypass it by editing the dh_viewer javascript code to suppress the exception but instead I get a different error:

image

It appears dhat-rs may be outputting bad json under certain circumstances but the issue is not obvious to me due to my lack of knowledge with dhat. More specifically with with pp frame data

blind-oracle commented 1 year ago

Same error here on Linux x86_64

dennis-barrett commented 7 months ago

Also receiving this error; x86_64-pc-windows-msvc with dhat 0.3.3.