glbinding
glbinding copied to clipboard
Remove memory allocation from logging callback invocation
Currently, implementation of Binding::log
allocates a move-constructed FunctionCall
on each invocation and passes a raw pointer to the callback. There are 2 issues with this:
- The interface does not tell the user that they have to
delete
the allocated object; - The allocation itself is unnecessary and is forced from the side of the library.
I was personally experiencing memory leaks when setting my own logging callback, until I figured out the first part; the second part just generally impacts performance in real-time scenarios.
This PR changes the callback signature from void(FunctionCall*)
to void(FunctionCall&&)
; implementation of Binding::log
now just moves the call further to the callback. The builtin aux logging callback that relied on dynamic allocation is modified to reflect the change.