Code Monkey home page Code Monkey logo

Comments (4)

foonathan avatar foonathan commented on June 9, 2024

I mean, yes, it fails. This is because the initial block size is simply too small for the block size. You asked for 27 buckets with huge node sizes, and give it a block size that's too small to contain their initial memory. I'm not sure what its supposed to do in that case?

As an aside, as soon as you're talking about nodes in the size of a couple of KiB, the default new/malloc implementation is probably better suited for allocation than the use of a free list.

from memory.

psalz avatar psalz commented on June 9, 2024

Being new to this library and from looking at the documentation, it's not obvious to me that (1) all buckets are allocated eagerly instead of on-demand, and in particular (2) that they need to fit into a single block.

Given that I triggered some assertion five levels deep into the library, I assumed this to be a bug. Not to be overbearing in requesting features from an open source project -- but since you asked: If this is intended behavior, I would prefer it to tell me during construction of the collection.

As an aside, as soon as you're talking about nodes in the size of a couple of KiB, the default new/malloc implementation is probably better suited for allocation than the use of a free list.

Good to know, thanks. In my case I'm using pinned memory, which is extremely slow to allocate, so I'm actually gaining performance even for large (~10 MiB) nodes. I ended up using a simple pool though, instead of the collection.

from memory.

foonathan avatar foonathan commented on June 9, 2024

Being new to this library and from looking at the documentation, it's not obvious to me that (1) all buckets are allocated eagerly instead of on-demand, and in particular (2) that they need to fit into a single block.

This isn't the case. By default, the initial block size is partitioned into equally sized chunks for all free lists, which is lazily committed.

If this is intended behavior, I would prefer it to tell me during construction of the collection.

Good point. I have added a check in the constructor in 9d3bda1.

from memory.

psalz avatar psalz commented on June 9, 2024

Nice - thanks!

from memory.

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.