Giter VIP home page Giter VIP logo

Comments (3)

MikeGitb avatar MikeGitb commented on August 16, 2024

Could that be solved by adding another create device function that takes two additional function pointers as parameters (one for allocation and one for deallocation)? Maybe with an additional void* parameter?

from sweep-sdk.

daniel-j-h avatar daniel-j-h commented on August 16, 2024

Not sure if device specific allocators make sense - we could simply store decltype(free) / decltype(malloc p) pointers in the library initialized with malloc and free and expose a function to set both? I don't quite fully understand the pros and cons here.

For the impl. we can then provide a C++ allocator passing it to the stdlib functions and collections we use. Here are some notes on allocators in C++11 and a stack allocator:

from sweep-sdk.

MikeGitb avatar MikeGitb commented on August 16, 2024

@daniel-j-h: You are probably right. That a global would suffice here.

The additional question here is how much information we want to give the userabout implementation details to tune the allocator (either as a static guarantee or something that can be queried during runtime).

Afaik there are 4 types of allocations:

  • Object creation: sweep device and serial device are created on the heap once
  • The queue between worker thread and user thread allocates and deallocates new blocks every few scans, but the totalnumber of allocations is bounded and can be expected to be small.
  • Each scanis allocated on the heap - in prinicple the number of possible allocations is unbounded if the user doesn't destroy them.
  • The c++ wrapper works with different data structures with their own allocators. However, as this is a small, header only component, it would be pretty simple for the users to modify that wrapper to their particular needs, so it probably doesn't needany special consideration.

from sweep-sdk.

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.