(4) Asking for help from other geeks
I began to ask for help from other geeks. I put this question on the stackoverflow: How to debug the memory is changed randomly issue, and received a very good and comprehensive answer. I recommended every one should read this post. I also sent emails to other geeks, most of them replied and gave some suggestions, such as exchange some variables definition sequences, etc. I also wanted to get the root cause from the core dump file directly: Can I know which thread change the global variable's value from core dump file?, but at the end, I am failed.
Until one day, I found anarticle (Aha, written in Chinese!)by accident, this article describes the bug is very similar to mine except his programming language is C++ and mine is C. I began to follow the steps he provided to find the root cause.
(5) Porting the program on Linux and use valgrind
I wanted to use valgrind to help find the bug, but my program runs on Solaris, and valgrind can't be used on Solaris, so another colleague helped to ported it on Linux. After running valgrind, I did find some memory-related bugs, but these bugs can't explain the cause of this issue. I still can't find the root cause.
(6) Using electric-fence
I tried to use electric-fence, but thehome page of electric-fence was closed. I found some packages and source codes from the internet, and tried to integrated them into my program. But this time, I also failed.

本文详细记录了作者解决一个程序中出现的随机内存更改问题的过程。作者尝试了多种方法,包括从Stack Overflow寻求帮助、移植程序到Linux并使用Valgrind进行调试、尝试使用Electric Fence等。最终在一个类似案例的启示下找到了可能的解决方案。
1255

被折叠的 条评论
为什么被折叠?



