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

Developer

Forums

Forums:

Hi ALL,
When I close my applet ,the message "module failed to free all memory " is displayed . But I freed all IFile,IFileMgr,IMenu controls using their respective "release" functions in the destructor.

What may be the problem.

Thanks,
Sumana.

hi...
this message means somewhere there is memory leak in code...
check for all allocation/deallocation...
sdg

hi...
this message means somewhere there is memory leak in code...
check for all allocation/deallocation...
sdg

look at the output in the debug window of Visual studio, or the output window (View->Output Window)..
The message will probably tell you where the memory is being allocated.
-Tyndal

look at the output in the debug window of Visual studio, or the output window (View->Output Window)..
The message will probably tell you where the memory is being allocated.
-Tyndal

Check your all pointers and free them. May be u allocate memory again to pointer with out releasing it. that can be one of the probable reason of memeory leak..

Check your all pointers and free them. May be u allocate memory again to pointer with out releasing it. that can be one of the probable reason of memeory leak..

Hi all I am trying to read bigger BMPs from files and using IMEMSTREAM I am showing them as shrinked Images in a IconViewMenuCtl.I read through Iteratively in a for loop for all the BMPS the a directory.I careate Instances of IMemstrem inthe loop.
If inside the loop I try to free then its crshing. Any guesses,
Regds,
Sandy..
OUTPUT
////////////////////////////////////////////////////////////
ISHELL_AppStart 16809984
WakeStart...
OEM_AppStarting OK
App Context Created 16809984
#*gST=16809984
App_SendStart(0)...
App Started...
WakeStart Done...
#*g*C=1000003:3
Loaded 'C:\WINNT\system32\wdmaud.drv', no matching symbolic information found.
Loaded 'C:\WINNT\system32\wdmaud.drv', no matching symbolic information found.
Loaded 'C:\WINNT\system32\wdmaud.drv', no matching symbolic information found.
Loaded 'C:\WINNT\system32\msacm32.drv', no matching symbolic information found.
Loaded 'C:\WINNT\system32\msacm32.dll', no matching symbolic information found.
The thread 0x2B0 has exited with code 0 (0x0).
#*p:ECode:101, Key:e035
#*p:ECode:100, Key:e035
ISHELL_AppStart 16818160
WakeStart...
#*gSU=16809984
#*gCL=16809984
WARNING: App Callback Pending (004F8598)
WARNING: App Callback Pending (013944DC)
WARNING: App Callback Pending (01394B40)
App_Cleanup(1008000)
** M-0 Released
App Context Created 16818160
#*gST=16818160
App_SendStart(0)...
sizeof( FileInfo ) = 76
App Started...
WakeStart Done...
** WARNING **
Callback 004F8964 consumed too much time (1843)
#*p:ECode:103, Key:e035
#*p:ECode:102, Key:e035
The thread 0x2B0 has exited with code 0 (0x0).
#*p:ECode:101, Key:e02e
#*p:ECode:100, Key:e02e
END Key Pressed
WakeClose ALL
App_Close (1009ff0) - RESUME
#*gCL=16818160
WARNING: App Callback Pending (013923DC)
WARNING: App Callback Pending (01393C24)
Preload - Found (sdk_mif/PhotoEd.mif)
App_Cleanup(1009ff0)
** PHOTOED Released
Validating Heap...
------ App Heap Info ------
112 - PHOTOED #152 DISP (L)
120 - PHOTOED #153 File: OEMBitmap_generic.h Line: 186 (L)
100 - PHOTOED #186 SHELL (L)
68 - PHOTOED #187 SHELL (L)
696 - PHOTOED #188 File: OEMBitmap_generic.h Line: 186 (L)
696 - PHOTOED #201 File: OEMBitmap_generic.h Line: 186 (L)
100 - PHOTOED #204 SHELL (L)
68 - PHOTOED #205 SHELL (L)
696 - PHOTOED #206 File: OEMBitmap_generic.h Line: 186 (L)
696 - PHOTOED #219 File: OEMBitmap_generic.h Line: 186 (L)
100 - PHOTOED #222 SHELL (L)
68 - PHOTOED #223 SHELL (L)
696 - PHOTOED #224 File: OEMBitmap_generic.h Line: 186 (L)
696 - PHOTOED #237 File: OEMBitmap_generic.h Line: 186 (L)
100 - PHOTOED #240 SHELL (L)
68 - PHOTOED #241 SHELL (L)
696 - PHOTOED #242 File: OEMBitmap_generic.h Line: 186 (L)
696 - PHOTOED #255 File: OEMBitmap_generic.h Line: 186 (L)
100 - PHOTOED #258 SHELL (L)
68 - PHOTOED #259 SHELL (L)
696 - PHOTOED #260 File: OEMBitmap_generic.h Line: 186 (L)
696 - PHOTOED #273 File: OEMBitmap_generic.h Line: 186 (L)
100 - PHOTOED #276 SHELL (L)
68 - PHOTOED #277 SHELL (L)
696 - PHOTOED #278 File: OEMBitmap_generic.h Line: 186 (L)
696 - PHOTOED #291 File: OEMBitmap_generic.h Line: 186 (L)
100 - PHOTOED #294 SHELL (L)
68 - PHOTOED #295 SHELL (L)
696 - PHOTOED #296 File: OEMBitmap_generic.h Line: 186 (L)
696 - PHOTOED #309 File: OEMBitmap_generic.h Line: 186 (L)
100 - PHOTOED #312 SHELL (L)
68 - PHOTOED #313 SHELL (L)
696 - PHOTOED #314 File: OEMBitmap_generic.h Line: 186 (L)
696 - PHOTOED #327 File: OEMBitmap_generic.h Line: 186 (L)
100 - PHOTOED #330 SHELL (L)
68 - PHOTOED #331 SHELL (L)
696 - PHOTOED #332 File: OEMBitmap_generic.h Line: 186 (L)
696 - PHOTOED #345 File: OEMBitmap_generic.h Line: 186 (L)
100 - PHOTOED #348 SHELL (L)
68 - PHOTOED #349 SHELL (L)
696 - PHOTOED #350 File: OEMBitmap_generic.h Line: 186 (L)
696 - PHOTOED #363 File: OEMBitmap_generic.h Line: 186 (L)
100 - PHOTOED #366 SHELL (L)
68 - PHOTOED #367 SHELL (L)
696 - PHOTOED #368 File: OEMBitmap_generic.h Line: 186 (L)
696 - PHOTOED #381 File: OEMBitmap_generic.h Line: 186 (L)
100 - PHOTOED #384 SHELL (L)
68 - PHOTOED #385 SHELL (L)
696 - PHOTOED #386 File: OEMBitmap_generic.h Line: 186 (L)
696 - PHOTOED #399 File: OEMBitmap_generic.h Line: 186 (L)
100 - PHOTOED #402 SHELL (L)
68 - PHOTOED #403 SHELL (L)
696 - PHOTOED #404 File: OEMBitmap_generic.h Line: 186 (L)
696 - PHOTOED #417 File: OEMBitmap_generic.h Line: 186 (L)
100 - PHOTOED #420 SHELL (L)
68 - PHOTOED #421 SHELL (L)
696 - PHOTOED #422 File: OEMBitmap_generic.h Line: 186 (L)
696 - PHOTOED #435 File: OEMBitmap_generic.h Line: 186 (L)
100 - PHOTOED #438 SHELL (L)
68 - PHOTOED #439 SHELL (L)
696 - PHOTOED #440 File: OEMBitmap_generic.h Line: 186 (L)
696 - PHOTOED #453 File: OEMBitmap_generic.h Line: 186 (L)
100 - PHOTOED #456 SHELL (L)
68 - PHOTOED #457 SHELL (L)
696 - PHOTOED #458 File: OEMBitmap_generic.h Line: 186 (L)
696 - PHOTOED #471 File: OEMBitmap_generic.h Line: 186 (L)
100 - PHOTOED #474 SHELL (L)
68 - PHOTOED #475 SHELL (L)
696 - PHOTOED #476 File: OEMBitmap_generic.h Line: 186 (L)
696 - PHOTOED #489 File: OEMBitmap_generic.h Line: 186 (L)
100 - PHOTOED #492 SHELL (L)
68 - PHOTOED #493 SHELL (L)
696 - PHOTOED #494 File: OEMBitmap_generic.h Line: 186 (L)
696 - PHOTOED #507 File: OEMBitmap_generic.h Line: 186 (L)
100 - PHOTOED #510 SHELL (L)
68 - PHOTOED #511 SHELL (L)
696 - PHOTOED #980 File: OEMBitmap_generic.h Line: 186 (L)
696 - PHOTOED #993 File: OEMBitmap_generic.h Line: 186 (L)
-------------------------
87820 Alloc - Total
0 OEM
17388 BREW
70432 Apps
7204 Wasted
104976 Free - Total
92040 Largest
8364 Largest Non Seq.
12936 Total Non Seq.
-------------------------
** PHOTOED Unloading
The program 'C:\Program Files\BREW SDK v2.1.0\Bin\BREW_Emulator.exe' has exited with code 0 (0x0).

Hi all I am trying to read bigger BMPs from files and using IMEMSTREAM I am showing them as shrinked Images in a IconViewMenuCtl.I read through Iteratively in a for loop for all the BMPS the a directory.I careate Instances of IMemstrem inthe loop.
If inside the loop I try to free then its crshing. Any guesses,
Regds,
Sandy..
OUTPUT
////////////////////////////////////////////////////////////
ISHELL_AppStart 16809984
WakeStart...
OEM_AppStarting OK
App Context Created 16809984
#*gST=16809984
App_SendStart(0)...
App Started...
WakeStart Done...
#*g*C=1000003:3
Loaded 'C:\WINNT\system32\wdmaud.drv', no matching symbolic information found.
Loaded 'C:\WINNT\system32\wdmaud.drv', no matching symbolic information found.
Loaded 'C:\WINNT\system32\wdmaud.drv', no matching symbolic information found.
Loaded 'C:\WINNT\system32\msacm32.drv', no matching symbolic information found.
Loaded 'C:\WINNT\system32\msacm32.dll', no matching symbolic information found.
The thread 0x2B0 has exited with code 0 (0x0).
#*p:ECode:101, Key:e035
#*p:ECode:100, Key:e035
ISHELL_AppStart 16818160
WakeStart...
#*gSU=16809984
#*gCL=16809984
WARNING: App Callback Pending (004F8598)
WARNING: App Callback Pending (013944DC)
WARNING: App Callback Pending (01394B40)
App_Cleanup(1008000)
** M-0 Released
App Context Created 16818160
#*gST=16818160
App_SendStart(0)...
sizeof( FileInfo ) = 76
App Started...
WakeStart Done...
** WARNING **
Callback 004F8964 consumed too much time (1843)
#*p:ECode:103, Key:e035
#*p:ECode:102, Key:e035
The thread 0x2B0 has exited with code 0 (0x0).
#*p:ECode:101, Key:e02e
#*p:ECode:100, Key:e02e
END Key Pressed
WakeClose ALL
App_Close (1009ff0) - RESUME
#*gCL=16818160
WARNING: App Callback Pending (013923DC)
WARNING: App Callback Pending (01393C24)
Preload - Found (sdk_mif/PhotoEd.mif)
App_Cleanup(1009ff0)
** PHOTOED Released
Validating Heap...
------ App Heap Info ------
112 - PHOTOED #152 DISP (L)
120 - PHOTOED #153 File: OEMBitmap_generic.h Line: 186 (L)
100 - PHOTOED #186 SHELL (L)
68 - PHOTOED #187 SHELL (L)
696 - PHOTOED #188 File: OEMBitmap_generic.h Line: 186 (L)
696 - PHOTOED #201 File: OEMBitmap_generic.h Line: 186 (L)
100 - PHOTOED #204 SHELL (L)
68 - PHOTOED #205 SHELL (L)
696 - PHOTOED #206 File: OEMBitmap_generic.h Line: 186 (L)
696 - PHOTOED #219 File: OEMBitmap_generic.h Line: 186 (L)
100 - PHOTOED #222 SHELL (L)
68 - PHOTOED #223 SHELL (L)
696 - PHOTOED #224 File: OEMBitmap_generic.h Line: 186 (L)
696 - PHOTOED #237 File: OEMBitmap_generic.h Line: 186 (L)
100 - PHOTOED #240 SHELL (L)
68 - PHOTOED #241 SHELL (L)
696 - PHOTOED #242 File: OEMBitmap_generic.h Line: 186 (L)
696 - PHOTOED #255 File: OEMBitmap_generic.h Line: 186 (L)
100 - PHOTOED #258 SHELL (L)
68 - PHOTOED #259 SHELL (L)
696 - PHOTOED #260 File: OEMBitmap_generic.h Line: 186 (L)
696 - PHOTOED #273 File: OEMBitmap_generic.h Line: 186 (L)
100 - PHOTOED #276 SHELL (L)
68 - PHOTOED #277 SHELL (L)
696 - PHOTOED #278 File: OEMBitmap_generic.h Line: 186 (L)
696 - PHOTOED #291 File: OEMBitmap_generic.h Line: 186 (L)
100 - PHOTOED #294 SHELL (L)
68 - PHOTOED #295 SHELL (L)
696 - PHOTOED #296 File: OEMBitmap_generic.h Line: 186 (L)
696 - PHOTOED #309 File: OEMBitmap_generic.h Line: 186 (L)
100 - PHOTOED #312 SHELL (L)
68 - PHOTOED #313 SHELL (L)
696 - PHOTOED #314 File: OEMBitmap_generic.h Line: 186 (L)
696 - PHOTOED #327 File: OEMBitmap_generic.h Line: 186 (L)
100 - PHOTOED #330 SHELL (L)
68 - PHOTOED #331 SHELL (L)
696 - PHOTOED #332 File: OEMBitmap_generic.h Line: 186 (L)
696 - PHOTOED #345 File: OEMBitmap_generic.h Line: 186 (L)
100 - PHOTOED #348 SHELL (L)
68 - PHOTOED #349 SHELL (L)
696 - PHOTOED #350 File: OEMBitmap_generic.h Line: 186 (L)
696 - PHOTOED #363 File: OEMBitmap_generic.h Line: 186 (L)
100 - PHOTOED #366 SHELL (L)
68 - PHOTOED #367 SHELL (L)
696 - PHOTOED #368 File: OEMBitmap_generic.h Line: 186 (L)
696 - PHOTOED #381 File: OEMBitmap_generic.h Line: 186 (L)
100 - PHOTOED #384 SHELL (L)
68 - PHOTOED #385 SHELL (L)
696 - PHOTOED #386 File: OEMBitmap_generic.h Line: 186 (L)
696 - PHOTOED #399 File: OEMBitmap_generic.h Line: 186 (L)
100 - PHOTOED #402 SHELL (L)
68 - PHOTOED #403 SHELL (L)
696 - PHOTOED #404 File: OEMBitmap_generic.h Line: 186 (L)
696 - PHOTOED #417 File: OEMBitmap_generic.h Line: 186 (L)
100 - PHOTOED #420 SHELL (L)
68 - PHOTOED #421 SHELL (L)
696 - PHOTOED #422 File: OEMBitmap_generic.h Line: 186 (L)
696 - PHOTOED #435 File: OEMBitmap_generic.h Line: 186 (L)
100 - PHOTOED #438 SHELL (L)
68 - PHOTOED #439 SHELL (L)
696 - PHOTOED #440 File: OEMBitmap_generic.h Line: 186 (L)
696 - PHOTOED #453 File: OEMBitmap_generic.h Line: 186 (L)
100 - PHOTOED #456 SHELL (L)
68 - PHOTOED #457 SHELL (L)
696 - PHOTOED #458 File: OEMBitmap_generic.h Line: 186 (L)
696 - PHOTOED #471 File: OEMBitmap_generic.h Line: 186 (L)
100 - PHOTOED #474 SHELL (L)
68 - PHOTOED #475 SHELL (L)
696 - PHOTOED #476 File: OEMBitmap_generic.h Line: 186 (L)
696 - PHOTOED #489 File: OEMBitmap_generic.h Line: 186 (L)
100 - PHOTOED #492 SHELL (L)
68 - PHOTOED #493 SHELL (L)
696 - PHOTOED #494 File: OEMBitmap_generic.h Line: 186 (L)
696 - PHOTOED #507 File: OEMBitmap_generic.h Line: 186 (L)
100 - PHOTOED #510 SHELL (L)
68 - PHOTOED #511 SHELL (L)
696 - PHOTOED #980 File: OEMBitmap_generic.h Line: 186 (L)
696 - PHOTOED #993 File: OEMBitmap_generic.h Line: 186 (L)
-------------------------
87820 Alloc - Total
0 OEM
17388 BREW
70432 Apps
7204 Wasted
104976 Free - Total
92040 Largest
8364 Largest Non Seq.
12936 Total Non Seq.
-------------------------
** PHOTOED Unloading
The program 'C:\Program Files\BREW SDK v2.1.0\Bin\BREW_Emulator.exe' has exited with code 0 (0x0).

pay attention to the bSysMem parameter of IMEMASTREAM_Set(), depending if you are MALLOCing memory or using other apis that are allocating it for you. When you release the memastream, it will call FREE or SYSFREE.
you are probably trying to free memory twice, or not freeing it at all..
you can also use IMEMASTREAM_SetEx() to provide your on function to handle freeing.. and then just make the function a no op, and handle your malloc/freeing normally
-Tyndal

pay attention to the bSysMem parameter of IMEMASTREAM_Set(), depending if you are MALLOCing memory or using other apis that are allocating it for you. When you release the memastream, it will call FREE or SYSFREE.
you are probably trying to free memory twice, or not freeing it at all..
you can also use IMEMASTREAM_SetEx() to provide your on function to handle freeing.. and then just make the function a no op, and handle your malloc/freeing normally
-Tyndal

I read through Iteratively in a for loop for all the BMPS the a directory.I careate Instances of IMemstrem inthe loop.
Hello Sandy,
As per ur warnings, do check those memory allocation and deallocations.Make sure its not been initialized twice.
Next check the loop size and the amount of iterations been performed.

I read through Iteratively in a for loop for all the BMPS the a directory.I careate Instances of IMemstrem inthe loop.
Hello Sandy,
As per ur warnings, do check those memory allocation and deallocations.Make sure its not been initialized twice.
Next check the loop size and the amount of iterations been performed.

From your log, it looks like your usage of either IBITMAP or IIMAGE interface is causing the leak. Post your code snippet so that forum members can give more input.
ruben

From your log, it looks like your usage of either IBITMAP or IIMAGE interface is causing the leak. Post your code snippet so that forum members can give more input.
ruben

here is the code chunk

here is the code chunk

Hi,
I am giving the code snippet where I am iterating through a loop to read all the BMPs in a directory and add them to a IconViewMenuctls Image property.I am Using IMEMASTREAM interface.
Here's some code chunk.
FunctionXYZ(...pApp...)
{
{
pInfo = (FileInfo*)MALLOC( sizeof( FileInfo ));
DBGPRINTF( "sizeof( FileInfo ) = %d", sizeof( FileInfo ));
}
if ( pCtlAddItem == NULL )
{
pCtlAddItem = (CtlAddItem*)MALLOC( sizeof( CtlAddItem ));
}
cls = ISHELL_GetHandler(pApp->a.m_pIShell, HTYPE_VIEWER, "image/bmp");
IMENUCTL_SetActive (pApp->m_pIconViewMenu, FALSE ) ;
IMENUCTL_SetRect(pApp->m_pIconViewMenu , &(pApp->m_pScreenRect) );
if(pApp->m_pIFileMgr)
{
if( SUCCESS == IFILEMGR_EnumInit(pApp->m_pIFileMgr,pszDir,FALSE) )
{
while(IFILEMGR_EnumNext(pApp->m_pIFileMgr,pInfo))
{
if(STRENDS(".bmp",pInfo->szName))
{
if (cls)
{
int err_code;
err_code = ISHELL_CreateInstance(pApp->a.m_pIShell, cls, (void **)(&img[InstCtr]));
DBGPRINTF("Error code is %d", err_code);
}
ISHELL_CreateInstance(pApp->a.m_pIShell, cls, (void **)(&img[InstCtr]));
ISHELL_CreateInstance(pApp->a.m_pIShell,AEECLSID_MEMASTREAM,(void **)(&pApp->m_pMemStream));
MEMSET( pCtlAddItem, 0, sizeof( CtlAddItem ));
PLDisplayAsThumbNail(pApp,pInfo->szName) ;
STRTOWSTR(pInfo->szName,wszBuff,MAX_FILE_NAME+1);
IMEMASTREAM_Set(pApp->m_pMemStream,(byte *)pApp->buffer ,(W*H*3)+54, 0, 0);
IIMAGE_SetStream(img[InstCtr], (IAStream*)pApp->m_pMemStream);
pCtlAddItem->pImage= img[InstCtr++];
pCtlAddItem->pText= STRTOWSTR(pInfo->szName,wszBuff,MAX_FILE_NAME+1);
pCtlAddItem->wItemID=ImageNum++;
if (IMENUCTL_AddItemEx(pApp->m_pIconViewMenu, pCtlAddItem)== FALSE)
{
DBGPRINTF("Unable to add menu item.");
........................
.....................

Hi,
I am giving the code snippet where I am iterating through a loop to read all the BMPs in a directory and add them to a IconViewMenuctls Image property.I am Using IMEMASTREAM interface.
Here's some code chunk.
FunctionXYZ(...pApp...)
{
{
pInfo = (FileInfo*)MALLOC( sizeof( FileInfo ));
DBGPRINTF( "sizeof( FileInfo ) = %d", sizeof( FileInfo ));
}
if ( pCtlAddItem == NULL )
{
pCtlAddItem = (CtlAddItem*)MALLOC( sizeof( CtlAddItem ));
}
cls = ISHELL_GetHandler(pApp->a.m_pIShell, HTYPE_VIEWER, "image/bmp");
IMENUCTL_SetActive (pApp->m_pIconViewMenu, FALSE ) ;
IMENUCTL_SetRect(pApp->m_pIconViewMenu , &(pApp->m_pScreenRect) );
if(pApp->m_pIFileMgr)
{
if( SUCCESS == IFILEMGR_EnumInit(pApp->m_pIFileMgr,pszDir,FALSE) )
{
while(IFILEMGR_EnumNext(pApp->m_pIFileMgr,pInfo))
{
if(STRENDS(".bmp",pInfo->szName))
{
if (cls)
{
int err_code;
err_code = ISHELL_CreateInstance(pApp->a.m_pIShell, cls, (void **)(&img[InstCtr]));
DBGPRINTF("Error code is %d", err_code);
}
ISHELL_CreateInstance(pApp->a.m_pIShell, cls, (void **)(&img[InstCtr]));
ISHELL_CreateInstance(pApp->a.m_pIShell,AEECLSID_MEMASTREAM,(void **)(&pApp->m_pMemStream));
MEMSET( pCtlAddItem, 0, sizeof( CtlAddItem ));
PLDisplayAsThumbNail(pApp,pInfo->szName) ;
STRTOWSTR(pInfo->szName,wszBuff,MAX_FILE_NAME+1);
IMEMASTREAM_Set(pApp->m_pMemStream,(byte *)pApp->buffer ,(W*H*3)+54, 0, 0);
IIMAGE_SetStream(img[InstCtr], (IAStream*)pApp->m_pMemStream);
pCtlAddItem->pImage= img[InstCtr++];
pCtlAddItem->pText= STRTOWSTR(pInfo->szName,wszBuff,MAX_FILE_NAME+1);
pCtlAddItem->wItemID=ImageNum++;
if (IMENUCTL_AddItemEx(pApp->m_pIconViewMenu, pCtlAddItem)== FALSE)
{
DBGPRINTF("Unable to add menu item.");
........................
.....................