Giter VIP home page Giter VIP logo

Comments (1)

manugoyal avatar manugoyal commented on July 17, 2024

So the reason we can't immediately free the old table during expansion time is that other threads may be running at the same time, and may be reading from that old table. If we free it in the expansion thread, the other threads could read invalid memory, when they resume. You'll see in the snapshot_and_lock_* methods, that we retry the whole thing if the table_info pointer changed before and after taking locks, but even still, we can't risk taking locks on a free'd TableInfo.

Therefore, we add the old table to a backlog, and try deleting it during resize, when no thread's hazard pointer is set to the old table.

That being said, we should be freeing the old table if there is no other thread looking at the table. We were not doing this, because the hazard pointer of the expansion thread was set to the old table, but I just pushed a commit (c87c193), that fixes this.

Now you should see in the unmodified count_freq:
Calling cuckoohash_map with hp 16
allocating 2^ 16 buckets
Calling cuckoohash_map with hp 22
allocating 2^ 22 buckets
de-allocating table with 2^ 16 buckets
...
de-allocating table with 2^ 22 buckets

Thanks for investigating!

from libcuckoo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.