In the past, when we didn’t turn interrupts off, we saw some pretty bad memory bloat because we weren’t handling any of the interrupts generated by RMP, and thus, the queue was being endlessly populated.
We’re now trying to employ interrupts to do user limits. I’m attempting to do this correctly, but I’m still seeing some pretty bad bloat.
Here’s the config code.
controller->InterruptMaskClear();
controller->InterruptMaskOnSet( RSI::RapidCode::RSIEventTypeUSER_LIMIT );
controller->InterruptEnableSet(true);
In another thread, I’m waiting for interrupts, and attempting to handle them.
RSI::RapidCode::RSIEventType event_type;
while (true) {
event_type = controller->InterruptWait(interrupt_loop_wait_max_ms);
// Handle the Interrupt
switch (event_type) {
case RSI::RapidCode::RSIEventTypeUSER_LIMIT:
My__HandleUserLimitInterrupt();
break;
case RSI::RapidCode::RSIEventTypeTIMEOUT:
// OK do nothing, process health checks, etc.
break;
// warning: we shouldn't be receiving unhandled interrupts
default:
break;
};
}
While we’re streaming motion, I’m seeing bloat on the order of 1.0+ MiB / minute.
Am I doing something wrong? Are there others coming in that I’m not looking for that could result in bloat? Do I have to do something to free memory?
The samples I found, userLimit.cpp and controllerInterrupts.cpp, don’t look remarkably different than what I’m doing, though neither of those examples are really doing anything with the interrupt(s).