OSC buffer size


#1

Greetings!
I’m trying to create a simple osc controller. When I tried to send an event with two strings my application froze, saying “libc++abi.dylib: terminating with uncaught exception of type osc::OutOfBufferMemoryException: out of buffer memory”. With one string all worked without a problem, so as with one string and one value. If the second value added, application friezes as described earlier. Sending like that:

// doesn’t work
if (ImGui::Button(“X”)){
OSCEvent event("/awesome/address");
event.addString(“x”);
event.addString(“x”);
mOscSender->send(event);
}
// works
if (ImGui::Button(“X”)){
OSCEvent event("/awesome/address");
event.addString(“x”);
event.addValue(13);
mOscSender->send(event);
}

// doesn’t work
if (ImGui::Button(“X”)){
OSCEvent event("/awesome/address");
event.addString(“x”);
event.addValue(13);
event.addValue(15);
mOscSender->send(event);
}

Unfortunately couldn’t find any information about the limitations of the buffer size or how to expand it.
Thank you for any advice!


#2

Hi Vlad!

I assume you’re running into this issue on OSX? I have the feeling that the length of the buffer isn’t calculated correctly when sending multiple strings as arguments. Thanks for the code that introduces the problem, will have a look asap!


#3

Correct. OSX 10.13.5. Also forgot to mention that I was using 0.1.0 version of NAP.
Thank you!


#4

Managed to reproduce the issue on windows as well. Turned out that the buffer that is allocated dynamically (ie: grows based on the size of the message) wasn’t big enough. The osc library needs a bit of ‘fluff’ in order to write the values in the packet stream. Took this fluff into account by adding some margin, seems to fix the issue.

Tested it using a ‘big’ message with 100s of values and verified it works. Thanks for spotting it, fix will be included in newer build. Or do you want me to compile a new package for you for OSX?


#5

Heya,

Pushed a new build including the fix to the server: https://www.napframework.com/NAP-0.2.2-macOS.zip

I recommend using this version over 0.1, as it includes many bug-fixes and new features compared to 0.1. Update for all platforms (osx, windows, linux) is pushed to the main page tonight.

Take a look at the oscmidi demo if you need a starting point in 0.2