In PostOfficeImpl::route:
public List<MessageReference> route(final ServerMessage message) throws Exception
{
long size = pagingManager.addSize(message);
addSize is being called before the message is actually routed.
If no filters match or for other reasons, the message might not actually be routed to any queues, but the size is added anyway, this is incorrect.
Instead, size should be added *after* we know which message references are returned.
Moreover, also the size is not taking into account the number of message references,
When we discussed this before, the memory estimate was going to take into account number of refs, e.g.
if number of refs == 0
memory estimate = 0
else
memory estimate = message estimate + number of refs * ref estimate
This doesn't seem to be the way it has been implemented.
If you have a topic with 1000s of subscribers it will make a big difference