Need help to solve access violation error of hdr histogram C++

150 Views Asked by At

Recently started attempting to use hdr_histogram in C++. Works like a charm in unix. But the same program breaks in Windows (Visual Studio 2017). Throws "Access violation" while calling hdr reset (hdr_interval_recorder.inactive). inactive is NULL, while in unix, it's not. I did call hdr_interval_recoder_init_all on the hdr_interval_recorder before this. Any suggestions on what I should start looking at?

1

There are 1 best solutions below

0
On

I was using an older version of hdr_histogram. Instead of calling hdr_reset(hdr_histogram*) and then calling hdr_interval_recorder_sample(), now we can call hdr_interval_recorder_sample_and_recycle(), which handles the case when the hdr_histogram pointer is NULL, which was the case when I was calling hdr_reset(). Honestly, still haven't figured out why their API was initialization inactive in unix and not in windows, but I can circumvent the problem using their new API.