Tales from a Trading Desk

Noise from an Investment Bank

When a C++ Memory Leak is NOT a Memory Leak

TIBCO RV is used throughout most investment banks, primarily because its a fast mechanism for sending market data.  Throw in RVD Caches, and you can begin to do some interesting stuff.  However, if an application is consuming a number of subjects (subscribing to different feeds), the callback thread must process each message as quickly as possible, otherwise RV appears to allocate memory to buffer the incoming messages.  In the stack trace below, 011282F0 bytes are allocated when the application became a slow consumer.

011282F0 bytes in 0x24977 allocations (@ 0x00000078 + 0x00001328) by: BackTrace10298
        ntdll!RtlDebugAllocateHeap+000000E1
        ntdll!RtlAllocateHeapSlowly+00000041
        ntdll!RtlAllocateHeap+00000E44
        msvcrt!calloc+000000EE
        tibrv!tibrvMsg_CopyShell+000001BC
        tibrv!tibrvMsg_Create+0000002F
        tibrv!tibrvMsg_CreateFromBuffer+00000016
        tibrv!tibrvBuffer_Expand+000028F7
        tibrv!tibrvBuffer_Expand+0000260D
        tibrv!tibrvInboxMonitor_DestroyEx+000009F0
        tibrv!tibrvBuffer_Expand+00005D92
        tibrv!tibrvThread_Create+000000D8
        msvcrt!_endthreadex+000000A0
        KERNEL32!BaseThreadStart+00000037

If the application managed to catch up with the incoming data (possibly due to the flow of messages on the subscribed subjects slowing), the message buffer memory will be freed - with the effect of the process seeing a drop in private bytes

Comments

No Comments

Leave a Comment

(required) 

(required) 

(optional)

(required)