Might be simpler to just say

    return callback->createAllocator(meta, activityId, allocatorId, flags);

rather than having the doCacheAdd flag + test.