greg7mdp / parallel-hashmap

A family of header-only, very fast and memory-friendly hashmap and btree containers.
https://greg7mdp.github.io/parallel-hashmap/
Apache License 2.0
2.53k stars 239 forks source link

Need a tag about `reserve` bug #232

Closed ZhengLChang closed 9 months ago

ZhengLChang commented 9 months ago

Can you give a tag about the bug(https://github.com/greg7mdp/parallel-hashmap/commit/9f52b30958f6533b929fde8b04557157ba1eeb40). We really need this tag.

For the bug detail, when use tag v1.3.8, we found a bug of reserve which lead to infinite loop in find_or_prepare_insert.

#include "parallel_hashmap/phmap.h"

int main(int argc, char* argv[]) {
  constexpr size_t SIZE = 900000;
  phmap::parallel_flat_hash_map<
      size_t, size_t, phmap::priv::hash_default_hash<size_t>,
      phmap::priv::hash_default_eq<size_t>,
      phmap::priv::Allocator<phmap::priv::Pair<size_t, size_t>>, 12>
      m;

  for (size_t i = 0; i < SIZE; ++i) {
    printf("i: %zu\n", i);
    m.reserve(1490);
    m.insert_or_assign(i, i);
  }
  return 0;
}
greg7mdp commented 9 months ago

You would like me to create a new release, right?

ZhengLChang commented 9 months ago

You would like me to create a new release, right?

No, I just need a tagging, like the latest tag 1.3.11.

greg7mdp commented 9 months ago

Thanks @ZhengLChang, I created v1.3.12.