Can an excessive use of smart pointers lead to an increase in system kernel calls?

133 Views Asked by At

Can an excessive use of smart pointers (especially shared_ptr) cause an increase in kernel calls?

I am trying to optimize and simplify a real-time (QNX) codebase. One focus besides memory and realtime efficiency is reducing system kernel calls. I've read through this and this, so I have a basic understanding that overusing shared_ptr's as call by value, might cause of some runtime performance issues. What I'm also curious about is whether this type of implementaions would also increase the kernel calls.

Please keep in mind that the processSend function is one of many functions that are called in a cycle and itself calls many other functions (like Default) in a similar way.

// getting called in every cycle (some milliseconds)
void signal::processSend(
    std::shared_ptr<const structA> readPtrA,
    std::shared_ptr<const structB> readPtrB,
    std::shared_ptr<const structC> readPtrC) {
        last_send_data = this->Default(readPtrA, readPtrB, readPtrC);
}

void signal::Default(
    std::shared_ptr<const structA> readPtrA,
    std::shared_ptr<const structB> readPtrB,
    std::shared_ptr<const structC> readPtrC) {
              // some value readings
}
0

There are 0 best solutions below