Memory leak in mFAST decoder

103 views
Skip to first unread message

Sandeep Kumar

unread,
Apr 11, 2018, 8:47:34 AM4/11/18
to objectcomputing_financial
Hi,

I'm using mFAST library to decode EMDI data provided by exchange. I'm using FAST-1.1 xml and mFAST v1.2.1. The issue is that 

I'm using following method for initialising my decoder

static const mfast::templates_description* _array[] = {scp::description(), EMDIFastTemplates_11::description()};

std::stringstream _strForDecoder;
mfast::fast_decoder _fastDecoder;
_fastDecoder.debug_log(&_strForDecoder);
_fastDecoder.include(_array, 2);

I'm not using any overloaded allocator. I'm only using mFAST provided allocator i.e. malloc_allocator.

For decoding I'm using following API
mfast::message_cref ref = _fastDecoder.decode(first, last);


The above API I'm invoking in loop and not creating object of fast_decoder time and again but as soon as message starts to arrive the memory foot print of my application keeps on increasing it does not stop at all. There is no memory allocation in my program which I verified multiple times. 

Am I missing something here about how to release the memory allocated by fast_decoder. I believed that it will be done as soon as message_cref object goes out of scope but it does not seem to be happening. 


In fact I tried to debug the memory allocation procedure by using debug_allocator from mFAST package and it turned out the only allocate and reallocate method of that API are being called. The deallocate API is not being called at all. I had hoped that memory created by object will be reused by system but it doesn't seem so. 


Any help will be deeply appreciated. 

Sandeep Kumar

unread,
Apr 12, 2018, 1:09:09 AM4/12/18
to quickfa...@googlegroups.com
I got the issue. It was due to string stream argument being passed in initialisation of _fastDecoder. The string stream object was used for all the visit APIs implemented in fast_decoder and hence it was continuously appended with data received. After removing that from initialisation there is no memory leak.

Apologies for bringing it up to you guys. 

--
You received this message because you are subscribed to the Google Groups "objectcomputing_financial" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quickfast_users+unsubscribe@googlegroups.com.
To post to this group, send email to quickfast_users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quickfast_users/7fab6e90-d60e-4355-bcc4-4799a1ec2a67%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages