Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

Hi,

I am getting the following memory leak

17-10-2011 09:05:05 AEEModule.c:266 - Warning -- memory leak, freeing, 0x7391280, ./DisplayImaging/wtle/product/source/port/brew\tsport.h:147, fs:/usermods/myapp

 

Please help me in identifying this .

Can you please elaborate?

Can you please elaborate?

In my app, i have a root container. An xy container is inserted in the root container. In the xycontainer i have inserted three Static widgets. I have removed the widgets from the container and then relese the static widgets. In my destructor function, i have implemented my code such a way to find the widgets dynamicaly and relase the widgets in the xy container.
 
Note: I am using IWidget_SetfonClass() to set the font to my static widget.
I am IWidget_SetText() with second parameter as true, to set the text to that static widget.
if(m_piCamContainer)
{
IWidget* piWidget = NULL;
while( piWidget = IXYContainer_GetWidget (m_piCamContainer, WIDGET_ZNORMAL, TRUE, FALSE))
{
IXYContainer_Remove(m_piCamContainer, piWidget );
IWidget_Release(piWidget);
}
if(m_pCamContainerWgt){
IWidget_Release(m_pCamContainerWgt);
m_pCamContainerWgt = NULL;
}
IXYContainer_Release(m_piCamContainer);
m_piCamContainer = NULL;

In my app, i have a root container. An xy container is inserted in the root container. In the xycontainer i have inserted three Static widgets. I have removed the widgets from the container and then relese the static widgets. In my destructor function, i have implemented my code such a way to find the widgets dynamicaly and relase the widgets in the xy container.
 
Note: I am using IWidget_SetfonClass() to set the font to my static widget.
I am IWidget_SetText() with second parameter as true, to set the text to that static widget.
if(m_piCamContainer)
{
IWidget* piWidget = NULL;
while( piWidget = IXYContainer_GetWidget (m_piCamContainer, WIDGET_ZNORMAL, TRUE, FALSE))
{
IXYContainer_Remove(m_piCamContainer, piWidget );
IWidget_Release(piWidget);
}
if(m_pCamContainerWgt){
IWidget_Release(m_pCamContainerWgt);
m_pCamContainerWgt = NULL;
}
IXYContainer_Release(m_piCamContainer);
m_piCamContainer = NULL;

Please make sure that all widget pointer references are released. Release method will release all resources/memory only when reference count is 0 else it will only decrease reference count.
Please note below points:
- Release widgets in reverse order or allocation/creation to avoid dangling pointers
- If creation of widget fails, release reference counted variables. Release all local variables.
- Whenever widget pointer is copied, reference count should be incremented properly and released accordingly.
- Whenever widget is added to container, container keeps one reference of it and is freed on releasing that container.
Please refer following docs for more details and tips on widgets:
1. http://qiscontent.qualcomm.com/TrainingContent/Brew_MP_Widget_Essentials...
2. http://qiscontent.qualcomm.com/TrainingContent/Introduction_to_Brew_MP_U...
 

Please make sure that all widget pointer references are released. Release method will release all resources/memory only when reference count is 0 else it will only decrease reference count.
Please note below points:
- Release widgets in reverse order or allocation/creation to avoid dangling pointers
- If creation of widget fails, release reference counted variables. Release all local variables.
- Whenever widget pointer is copied, reference count should be incremented properly and released accordingly.
- Whenever widget is added to container, container keeps one reference of it and is freed on releasing that container.
Please refer following docs for more details and tips on widgets:
1. http://qiscontent.qualcomm.com/TrainingContent/Brew_MP_Widget_Essentials...
2. http://qiscontent.qualcomm.com/TrainingContent/Introduction_to_Brew_MP_U...