To comment on the following update, log in, then open the issue: http://www.openoffice.org/issues/show_bug.cgi?id=113722 Issue #|113722 Summary|cppuhelper: New a new chart object or load a document |with chart, it shows obvious memory leak because of Ch |artModel object leaks Component|udk Version|OOO320m11 Platform|All URL| OS/Version|All Status|UNCONFIRMED Status whiteboard| Keywords| Resolution| Issue type|PATCH Priority|P2 Subcomponent|code Assigned to|kr Reported by|zhangjfibm
------- Additional comments from zhangjf...@openoffice.org Sat Aug 7 14:02:28 +0000 2010 ------- The call stack create the ChartModel is, chartmodelmi.dll!chart::ChartModel::ChartModel(const com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> & xContext={...}) Line 108 C++ chartmodelmi.dll!chart::ChartModel::create(const com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> & xContext={...}) Line 210 + 0x55 bytes C++ cppuhelper3MSC.dll!cppu::OSingleFactoryHelper::createInstanceEveryTime(const com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> & xContext={...}) Line 177 + 0x10 bytes C++ cppuhelper3MSC.dll!cppu::OSingleFactoryHelper::createInstanceWithContext(const com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> & xContext={...}) Line 218 + 0x19 bytes C++ cppuhelper3MSC.dll!cppu::OFactoryComponentHelper::createInstanceWithContext(const com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> & xContext={...}) Line 502 + 0x11 bytes C++ > cppuhelper3MSC.dll!cppu::OSingleFactoryHelper::createInstanceWithArgumentsAndContext(const com::sun::star::uno::Sequence<com::sun::star::uno::Any> & rArguments={...}, const com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> & xContext={...}) Line 226 + 0x16 bytes C++ cppuhelper3MSC.dll!cppu::OFactoryComponentHelper::createInstanceWithArgumentsAndContext(const com::sun::star::uno::Sequence<com::sun::star::uno::Any> & rArguments={...}, const com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> & xContext={...}) Line 521 + 0x15 bytes C++ cppuhelper3MSC.dll!cppu::ORegistryFactoryHelper::createInstanceWithArgumentsAndContext(const com::sun::star::uno::Sequence<com::sun::star::uno::Any> & rArguments={...}, const com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> & xContext={...}) Line 828 + 0x2c bytes C++ bootstrap.uno.dll!stoc_smgr::OServiceManager::createInstanceWithArgumentsAndContext(const rtl::OUString & rServiceSpecifier={...}, const com::sun::star::uno::Sequence<com::sun::star::uno::Any> & rArguments={...}, const com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> & xContext={...}) Line 1340 + 0x29 bytes C++ bootstrap.uno.dll!stoc_smgr::OServiceManager::createInstanceWithArguments(const rtl::OUString & rServiceSpecifier={...}, const com::sun::star::uno::Sequence<com::sun::star::uno::Any> & rArguments={...}) Line 1396 + 0x25 bytes C++ embobj.dll!CreateDocument(const com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> & _rxFactory={...}, const rtl::OUString & _rDocumentServiceName={...}, bool _bEmbeddedScriptSupport=true) Line 216 + 0x37 bytes C++ embobj.dll!OCommonEmbeddedObject::InitNewDocument_Impl() Line 310 + 0x41 bytes C++ embobj.dll!OCommonEmbeddedObject::setPersistentEntry(const com::sun::star::uno::Reference<com::sun::star::embed::XStorage> & xStorage={...}, const rtl::OUString & sEntName={...}, long nEntryConnectionMode=0x00000001, const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> & lArguments={...}, const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> & lObjArgs={...}) Line 1097 + 0x12 bytes C++ In above callstack, it calls ... OSingleFactoryHelper::createInstanceWithArgumentsAndContext() ...-> cppuhelper3MSC.dll!cppu::OSingleFactoryHelper::createInstanceWithArgumentsAndContext() ... -> chartmodelmi.dll!chart::ChartModel::ChartModel() Below is the ChartModel Ctor, it creates cyclic reference between ChartModel and ChartModel.m_pImplChartModel. To release it, ChartModel::Dispose() must be called. ChartModel::ChartModel(uno::Reference<uno::XComponentContext > const & xContext) : m_aLifeTimeManager( this, this ) , m_bReadOnly( sal_False ) , m_bModified( sal_False ) , m_nInLoad(0) , m_bUpdateNotificationsPending(false) , m_aControllers( m_aModelMutex ) , m_nControllerLockCount(0) , m_xContext( xContext ) // default visual area is 8 x 7 cm , m_aVisualAreaSize( 8000, 7000 ) { OSL_TRACE( "ChartModel: CTOR called" ); // attention: passing this as reference to ImplChartModel m_pImplChartModel.reset( new impl::ImplChartModel( xContext, this )); // reference } In OSingleFactoryHelper::createInstanceWithArgumentsAndContext(), xInit.is() always fails, OSingleFactoryHelper::createInstanceWithArgumentsAndContext() { Reference< XInterface > xRet( createInstanceWithContext( xContext ) ); Reference< lang::XInitialization > xInit( xRet, UNO_QUERY ); if (xInit.is()) // When creating ChartModel, it always fails!!! { xInit->initialize( rArguments ); } else { ... throw lang::IllegalArgumentException(); // } ... } So in CreateDocument() in persistence.cxx, it will recreate the ChartModel again. To fix this problem, OSingleFactoryHelper::createInstanceWithArgumentsAndContext(), before throwing out lang::IllegalArgumentException, ChartModel::dispose() must be called. --------------------------------------------------------------------- Please do not reply to this automatically generated notification from Issue Tracker. Please log onto the website and enter your comments. http://qa.openoffice.org/issue_handling/project_issues.html#notification --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@udk.openoffice.org For additional commands, e-mail: issues-h...@udk.openoffice.org --------------------------------------------------------------------- To unsubscribe, e-mail: allbugs-unsubscr...@openoffice.org For additional commands, e-mail: allbugs-h...@openoffice.org