Comments (5)
Hey,
Thanks for the report!
I think the prefer fix is is to allow the LinearAllocator to grow. What could be done is just to bump the size and then add the ability to grow. I think this will be pretty rate to happen so it should be fine really (as the realloced LinearAllocator will always be alive the resizing may just happen a very few times)
So to outline it:
In LinearAllocator_allocAligned
we should check if there is enough space left. If there isn't we should just realloc the buffer and bump the size times two and store the new size. I think this should be just a few lines of code to implement.
Would you be willing to do a PR with the fix? (I'm currently in the middle of dealing with a flooded basement so I don't have a setup for it right now :( )
from rocket.
I'm a bit preoccupied at the moment, but wanted to at least document the issue upstream before completely forgetting about it, since I already bumped the malloc() here to stop the bleeding.
I still want to get the multiclient changes merged upstream so maybe when I'm back on that side of things if this isn't already fixed I'll do that too...
Good luck with the flooding! I've helped family with that in the past, sucks.
from rocket.
Thanks!
from rocket.
So to outline it:
In
LinearAllocator_allocAligned
we should check if there is enough space left. If there isn't we should just realloc the buffer and bump the size times two and store the new size. I think this should be just a few lines of code to implement.
A problem with that simple approach is it would invalidate all the outstanding pointers already handed out via LinearAllocator_allocZero()
.
And since the existing API is for the caller to provide the space to LinearAllocator_create()
, it's awkward at best to make LinearAllocator enlarge/replace that space. The scratchpad use case isn't even passing in a heap-allocated pointer...
It could all be changed to add a new chunk of space when exhausted, chaining to the previous for cleanup handling... but it'll require LinearAllocator_create()
owning the memory and not taking it as an input... or maybe if you pass NULL as the space to indicate it's growable, and LinearAllocator allocates it for you, the scratchpad would then be non-growable.
The only sane thing to do without changing the existing dead-simple API is simply enlarge the malloc().
from rocket.
Yeah, that makes sense. Lets just bump the the malloc.
from rocket.
Related Issues (20)
- Support 3 channels as color
- Make the project the root of the repo, submodule original rocket HOT 13
- Support for jsRocket HOT 7
- PageDown/PageUp don't work HOT 5
- CurveEditor HOT 6
- FYI: Python Client HOT 3
- Pause state from the client HOT 3
- Look dazzling at The Meteoriks 2017 HOT 1
- Strange selection when adding new group track
- Make resize button area larger
- Add support to bias the next key
- Add support for deleting keys with delete button HOT 3
- No UI on macOS Mojave HOT 14
- Dead links in README HOT 1
- Replace BASS with minimp3
- Replace window managment with glfw
- Add Metal backend for macOS
- Editor segfaults when saving in Linux HOT 2
- Windows builds crash on load/save dialog HOT 2
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 rocket.