[Quickfix-users] initiatoe->stop() Memory Leak
Brought to you by:
orenmnero
From: William B. <wb...@UD...> - 2007-07-02 18:20:32
|
Hi All, I am developing a VS6 MFC Dialog-Based FIX application and I cannot get past a memory leak issue. I have created a simple app to reproduce my problem. The main Dialog creates the quickfix objects, including a UIThread which implements the quickfix app, on the heap as follows: BOOL CQFTraderDlg::OnInitDialog() { CDialog::OnInitDialog(); m_pAppThread = (CTheAppThread*)AfxBeginThread(RUNTIME_CLASS(CTheAppThread), THREAD_PRIORITY_NORMAL, 0, CREATE_SUSPENDED); //perform thread initialization here... m_pAppThread->ResumeThread(); settingsPtr = new FIX::SessionSettings("settings.txt"); storeFactoryPtr = new FIX::FileStoreFactory( *settingsPtr ); logFactoryPtr = new FIX::FileLogFactory( *settingsPtr ); screenLogFactoryPtr = new FIX::ScreenLogFactory( true, true, true ); initiatorPtr = new FIX::ThreadedSocketInitiator( *m_pAppThread, *storeFactoryPtr, *settingsPtr, *logFactoryPtr ); return TRUE; } Then I click the "cancel" button, on the dlg, which executes: void CQFTraderDlg::OnCancel() { initiatorPtr->stop(true); while( !initiatorPtr->isStopped() ); delete initiatorPtr; //delete screenLogFactoryPtr; //delete logFactoryPtr; //delete storeFactoryPtr; //delete settingsPtr; m_pAppThread->PostThreadMessage(WM_QUIT,0,0); CDialog::OnCancel(); } Uncommenting the deletes above does not make a difference. If the memory dump would be helpful, I can post it. Clearly I am not cleaning up something correctly. TIA, -Billy |