简体   繁体   English

需要帮助解决hdr直方图C++访问冲突错误

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

Recently started attempting to use hdr_histogram in C++.最近开始尝试在 C++ 中使用 hdr_histogram。 Works like a charm in unix.在 unix 中就像一个魅力。 But the same program breaks in Windows (Visual Studio 2017).但同样的程序在 Windows (Visual Studio 2017) 中会中断。 Throws "Access violation" while calling hdr reset (hdr_interval_recorder.inactive).调用 hdr reset (hdr_interval_recorder.inactive) 时抛出“访问冲突”。 inactive is NULL, while in unix, it's not. inactive 是 NULL,而在 unix 中则不是。 I did call hdr_interval_recoder_init_all on the hdr_interval_recorder before this.在此之前,我确实在 hdr_interval_recorder 上调用了 hdr_interval_recoder_init_all。 Any suggestions on what I should start looking at?关于我应该开始看什么的任何建议?

I was using an older version of hdr_histogram.我使用的是旧版本的 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().现在我们可以调用 hdr_interval_recorder_sample_and_recycle(),而不是调用 hdr_reset(hdr_histogram*) 然后调用 hdr_interval_recorder_sample(),它处理 hdr_histogram 指针为 NULL 的情况,这就是我调用 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.老实说,仍然没有弄清楚为什么他们的 API 在 unix 而不是在 Windows 中初始化无效,但我可以使用他们的新 API 来规避这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM