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

Developer

Forums

Forums:

Hi,
I'm using IApplet_Release in AEEClsCreateInstance function to free up the resources accquired by the Applet, in case we are out of memory. My code looks like this
Quote:
int AEEClsCreateInstance(AEECLSID ClsId,IShell * pIShell,IModule * po,void ** ppObj)
{
*ppObj = NULL;
if(ClsId == AEECLSID_MyGame)
{
if(AEEApplet_New(sizeof(CGameData), ClsId, pIShell,po, (IApplet**)ppObj,(AEEHANDLER)MyGame_HandleEvent,
(PFNFREEAPPDATA)MyGame_FreeAppData))
{
if(MyGame_InitAppData((IApplet*)*ppObj))
{
return(AEE_SUCCESS);
}
else
{
IAPPLET_Release((IApplet*)*ppObj);
return EFAILED;
}

}

}
return(EFAILED);

When i test my application under low memory in Emulator It calls the IApplet_Release and return EFAILED successfully but at the end AV is raised.
I changed the IApplet_Release with my Free Resources Function and no exception is raised but some resources are not freed properly. I've tested the same with the samples provided by BREW and let the Initialize function return FALSE which in turn should call the IApplet_Release and the same AV is thrown.

Is this bug with BREW 1.0.1 SDK or am i missing something.

Any help is appreciated.

Thanks in advance,

Regards,
Ali Naqvi

If your application specific init data function fails, you can call corresponding free data funciton and return EFAILED.
BREW framework will release the memory it allocates in AEEApplet_New.
If you are calling IAPPLET_Release on your own, you will get call to MyGame_FreeAppData (free data handler function). There may be problem in your free data handler function. Make sure that you are not trying to release any invalid interface pointer(because your app init function couldn't do initialization properly).
ruben

If your application specific init data function fails, you can call corresponding free data funciton and return EFAILED.
BREW framework will release the memory it allocates in AEEApplet_New.
If you are calling IAPPLET_Release on your own, you will get call to MyGame_FreeAppData (free data handler function). There may be problem in your free data handler function. Make sure that you are not trying to release any invalid interface pointer(because your app init function couldn't do initialization properly).
ruben

Hi ruben,
Thanks for reply and conditions and tests i've done were written in my previous question. Quoting your reply
Quote:
If your application specific init data function fails, you can call corresponding free data funciton and return EFAILED.
BREW framework will release the memory it allocates in AEEApplet_New.
If i only call free resources functions of my applet then no exception is raised at all but blank screen is shown in end which indicates that my applet didn't succeed in freeing up all the resources. As i've freed all the resources which i accquired in initialize procedure. So this means the resources accquired in AEEApplet_New are not freed by the BREW.
Quote:
If you are calling IAPPLET_Release on your own, you will get call to MyGame_FreeAppData (free data handler function). There may be problem in your free data handler function. Make sure that you are not trying to release any invalid interface pointer(because your app init function couldn't do initialization properly).
Sure IApplet_Release is calling my free resource function / procedure. As i've stated above that if i only call my free resources function no exception is being raised this proves that nothing is wrong with my freeData procedure.
I've debugged the code and find out that code works fine in AEEClsCreateInstance function and EFAILED is returned successfully by this function and controls goes back to AEEMod_CreateInstance function which in turns return the value recieved by AEEClsCreateInstance and Exception is thrown.
I've checked that there is problem with BREW Emulator 1.0.1 which is actually throwing the exception and i tested the same piece of code with BREW 2.0 Emulator and no exception is thrown by this Emulator which proves that there is some problem with BREW 1.0 Emulator.
Really thanks for your precious time.
Regards,
Ali Naqvi

Hi ruben,
Thanks for reply and conditions and tests i've done were written in my previous question. Quoting your reply
Quote:
If your application specific init data function fails, you can call corresponding free data funciton and return EFAILED.
BREW framework will release the memory it allocates in AEEApplet_New.
If i only call free resources functions of my applet then no exception is raised at all but blank screen is shown in end which indicates that my applet didn't succeed in freeing up all the resources. As i've freed all the resources which i accquired in initialize procedure. So this means the resources accquired in AEEApplet_New are not freed by the BREW.
Quote:
If you are calling IAPPLET_Release on your own, you will get call to MyGame_FreeAppData (free data handler function). There may be problem in your free data handler function. Make sure that you are not trying to release any invalid interface pointer(because your app init function couldn't do initialization properly).
Sure IApplet_Release is calling my free resource function / procedure. As i've stated above that if i only call my free resources function no exception is being raised this proves that nothing is wrong with my freeData procedure.
I've debugged the code and find out that code works fine in AEEClsCreateInstance function and EFAILED is returned successfully by this function and controls goes back to AEEMod_CreateInstance function which in turns return the value recieved by AEEClsCreateInstance and Exception is thrown.
I've checked that there is problem with BREW Emulator 1.0.1 which is actually throwing the exception and i tested the same piece of code with BREW 2.0 Emulator and no exception is thrown by this Emulator which proves that there is some problem with BREW 1.0 Emulator.
Really thanks for your precious time.
Regards,
Ali Naqvi

There are lots of bugs reported against BREW 1.0 emulator. I would recommend that you use BREW 2.0 emulator.
But make sure that you compile your against correct version of BREW SDK (as it is in your target device) when you compile for phone hardware.
ruben

There are lots of bugs reported against BREW 1.0 emulator. I would recommend that you use BREW 2.0 emulator.
But make sure that you compile your against correct version of BREW SDK (as it is in your target device) when you compile for phone hardware.
ruben

Hi ruben,
Thanks for your reply. Yes we do the development using BREW 1.0.1 SDK and do windows testing on Emulator 2.0 as 2.0 Emulator can find several serious uneasy to find bugs emulated correctly by 1.0 Emulator.
Again thanks for your time.
Regards,
Ali Naqvi

Hi ruben,
Thanks for your reply. Yes we do the development using BREW 1.0.1 SDK and do windows testing on Emulator 2.0 as 2.0 Emulator can find several serious uneasy to find bugs emulated correctly by 1.0 Emulator.
Again thanks for your time.
Regards,
Ali Naqvi