-
-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No reliable way for reclaiming memory with custom alloc callback #315
Comments
Is publishing an |
Yes, that would do the job for the no more data case.
Normally I would suggest something like an deallocation callback, a chance for the user of the library to attach a callback in which previously allocated memory can be freed. This callback would be made at the end of Maybe it makes sense to fire a Maybe consider adding a new type of event The use case I have in mind is to have a pool of buffers and recycle those using the custom allocation callback (and the counterpart as discussed above). This pool could be global, thread local but I can also see reasons why this pool would need to be tied to the Another case to consider is where static buffers might be used for receiving data, similar to what |
I have come to the conclusion that for my project ASIO is a better fit, mainly because of it's low level capabilities. Unless this discussion is relevant or valuable to others, I propose closing this issue. |
Thank you for this amazing library.
I'm gauging if
uvw
is suitable for low-latency & low-jitter media streaming over udp (using rtp). So far it looks quite promising.One of the things I ran into is that there doesn't seem to be a reliable way of reclaiming memory which was previously allocated inside a custom allocator callback (link).
Inside the
uvw::udp_handle::recv_callback
, ownership of the allocated memory is taken by wrapping it with astd::unique_ptr
(link). Although this is good practice, theudp_data_event
is not triggered in all cases after that. When there is no more data to read or when there is a transmission error theudp_data_event
is never called which makes it impossible to move the memory out of thestd::unique_ptr
. In practice thenread == 0 && addr == nullptr
case happens a lot.Unless I'm missing something (please let me know if this is the case), it would be really appreciated if you could add functionality that helps reclaiming memory in a consistent way. I'm thinking maybe adding an event type makes sense.
I'd also be willing to spend time on this and come up with a PR. Let me know if you'd prefer this.
The text was updated successfully, but these errors were encountered: