Comments (3)
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.
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:
- http://howardhinnant.github.io/allocator_boilerplate.html
- http://howardhinnant.github.io/stack_alloc.html
from sweep-sdk.
@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)
- Sweeppy hangs after returning 1~3 scan results HOT 6
- libsweep does not handle unexpected unplug gracefully HOT 1
- RuntimeError: baud rate could not be determined HOT 4
- Time Stamps HOT 8
- Non-blocking reads HOT 2
- sweep red light, no data HOT 2
- macOS - Package ´openal´, required by ´sfml-audio´ not found HOT 3
- Mac: fatal error: ´zmq.hpp´ file not found HOT 2
- MacOS - cannot fetch event from a worker thread (OS X restriction) HOT 1
- Invalid response checksum when attempting to adjust sample rate HOT 5
- libsweep Windows build failing HOT 2
- Laggy values from Sweep with piCamera integration in Raspberry pi 3 b HOT 6
- Support for FreeBSD HOT 5
- Lock up when sweep_device_construct is called too soon after device connect
- I get the lidar data is intermittent
- Non real-time frames receiving
- sweep-ctl: Error: invalid motor info response commands
- sweep-ctl et al. freezes up on first run, but works fine on second run
- RUNTIMEERROR: READING FROM SERIAL DEVICE FAILED - Sweeppy
- Hiring
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sweep-sdk.