diff --git a/src/system/kernel/messaging/MessagingService.cpp b/src/system/kernel/messaging/MessagingService.cpp index c0dc43ac21..8f8665641a 100644 --- a/src/system/kernel/messaging/MessagingService.cpp +++ b/src/system/kernel/messaging/MessagingService.cpp @@ -450,6 +450,14 @@ MessagingService::_AllocateCommand(int32 commandWhat, int32 size, // delete the discarded areas (save one) ObjectDeleter discardedAreaDeleter; MessagingArea *discardedArea = NULL; + // TODO: this loop still has a flaw + // - if the first area in the list is full, + // we will always allocate a new area to add the next message to, + // even if we already have another area in the chain with enough space + // if the allocation fails this probably needs to walk the list + // and keep trying for each non-empty area it finds until it either + // succeeds or hits the last area. Only in the latter case should we + // be allocating a new one. while (fFirstArea != fLastArea) { area = fFirstArea; area->Lock();