Hacker News new | ask | show | jobs
by FartyMcFarter 1565 days ago
One of the most fun non-determinism bugs I have worked on was the result of using an associative container with the key type being a pointer (like a std::map<void*, int> or similar), and then iterating over this container.

Since the order and value of dynamically allocated pointers is non-deterministic, this resulted in diverging behaviour at some point.

Better be sure that all your tools used during the build don't do this kind of thing as well.

1 comments

With ASLR off, the order and value should be identical between runs on the same malloc implementation, as stochastic allocators are not in common use
Not when multi-threading is involved, I would think. That or timing-dependent code making allocations.
That's true.