-3

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?

Cindy Meister
  • 25,071
  • 21
  • 34
  • 43
  • C++ does not work this way. Just because it works "like a charm" for unix doesn't mean there are no hidden bugs that, for some reason, the Windows version is picking up. When you fix the bug(s) or address the issue for Windows, don't be surprised if you have to make the same fixes for the unix version (even though it didn't crash for unix). – PaulMcKenzie Mar 30 '20 at 18:08
  • Make sure you are using the correct binaries. Visual Studio 2017 is compatible with Visual Studio 2015 and Visual Studio 2019 and no other compiler other than possibly clang. – drescherjm Mar 30 '20 at 18:13
  • Do you use `long` data types? Those have a different size in MSVC. – rustyx Mar 30 '20 at 18:14
  • Please start with the [tour] and read [ask]. You'd also need a [mcve] for questions that ask for debugging help. – Ulrich Eckhardt Mar 30 '20 at 21:02

1 Answers1

0

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.