diff --git a/lib/shared_memory.cpp b/lib/shared_memory.cpp index 2f69a4e6..fafbccd7 100644 --- a/lib/shared_memory.cpp +++ b/lib/shared_memory.cpp @@ -1001,8 +1001,10 @@ namespace IPC { amount = lastFilled+1; VERYHIGH_MSG("Shared memory %s is now at count %u", baseName.c_str(), amount); } - //stop, we're guaranteed no more pages are full at this point - break; + if (id >= amount + 100) { + //stop, we're guaranteed no more pages are full at this point + break; + } } } } else { @@ -1023,11 +1025,13 @@ namespace IPC { amount = lastFilled+1; VERYHIGH_MSG("Shared memory %s is now at count %u", baseName.c_str(), amount); } - //stop, we're guaranteed no more pages are full at this point - if (empty) { - free(empty); + if (id >= amount + 100) { + //stop, we're guaranteed no more pages are full at this point + if (empty) { + free(empty); + } + break; } - break; } } }