Memory leak in Advx 8900 | developer.brewmp.com Memory leak in Advx 8900 | developer.brewmp.com

Developer

Memory leak in Advx 8900

Forums:

Hi,

On Advx 8900, if we keep on exiting from the game, memory available decreases gradually. At a instant when memory available is not sufficient for the game to load, it fails to load images.
When the game is not able to load image, I loaded this image (which didn't get loaded) again in next timer callback and it got loaded successfully.

Is there any workaround for this if it is a device issue and will NSTL pass this bug?

Are you sure your code doesn't have memory leaks?

Are you sure your code doesn't have memory leaks?

Hi,
Yes. The same code have been passed by NSTL on other devices.
The other thing is that this behaviour is seen with all the other 8900 games which passed NSTL.
Following is the detailed behaviour of 8900:
1) when keeping on exiting the game, memory available decreases gradually.
2) At a instant when the memory available becomes very less to load the game, it increases to its original value (value which we get when we just started the device). And the game runs smoothly thereafter.
3) But sometimes during such above said instant, it fails to load images.
The same behaviour is with 8910 but there the 3rd condition doesn't happen.

Hi,
Yes. The same code have been passed by NSTL on other devices.
The other thing is that this behaviour is seen with all the other 8900 games which passed NSTL.
Following is the detailed behaviour of 8900:
1) when keeping on exiting the game, memory available decreases gradually.
2) At a instant when the memory available becomes very less to load the game, it increases to its original value (value which we get when we just started the device). And the game runs smoothly thereafter.
3) But sometimes during such above said instant, it fails to load images.
The same behaviour is with 8910 but there the 3rd condition doesn't happen.

Can you explain what you mean in step 1?
It's likely that this is just how memory management is performed on the device.

Can you explain what you mean in step 1?
It's likely that this is just how memory management is performed on the device.

Yes. Following is the description of step 1 discussed earlier:
Step 1:
1a) I enabled memory display using ###3 sequence in the GetItNow window where the game icons are listed.
1b) Noted down the available memory.
1c) Start the game.
1d) After the game is successfully launched (for ex. we see the title screen of game), press clr key to exit the game.
1e) After exiting, it again goes to the GetItNow window. Now here we will see that the memory available decreases as compared to what it was before starting the game.
1f) Repeat the above steps and we will notice that the memory available go on decreasing.
The next two steps follow for reference:
Steps 2 and 3:
2) At a instant when the memory available becomes very less to load the game, it increases to its original value (value which we get when we just started the device). And the game runs smoothly thereafter.
3) But sometimes during such above said instant, it fails to load images.
The 3rd step is my problem.
Thanks.

Yes. Following is the description of step 1 discussed earlier:
Step 1:
1a) I enabled memory display using ###3 sequence in the GetItNow window where the game icons are listed.
1b) Noted down the available memory.
1c) Start the game.
1d) After the game is successfully launched (for ex. we see the title screen of game), press clr key to exit the game.
1e) After exiting, it again goes to the GetItNow window. Now here we will see that the memory available decreases as compared to what it was before starting the game.
1f) Repeat the above steps and we will notice that the memory available go on decreasing.
The next two steps follow for reference:
Steps 2 and 3:
2) At a instant when the memory available becomes very less to load the game, it increases to its original value (value which we get when we just started the device). And the game runs smoothly thereafter.
3) But sometimes during such above said instant, it fails to load images.
The 3rd step is my problem.
Thanks.

That's not the memory available, it's the largest contiguous free block of memory.
I'd say double-check to make sure there are no memory leaks. It sounds like the device is performing garbage collection/memory management when the amount of available memory is too low. In this case, do you see any error return values while attempting to display the images?

That's not the memory available, it's the largest contiguous free block of memory.
I'd say double-check to make sure there are no memory leaks. It sounds like the device is performing garbage collection/memory management when the amount of available memory is too low. In this case, do you see any error return values while attempting to display the images?

Hi,
I reviewed the code again and even tested it on the emulator and other devices. But it didn't seem to be having memory leaks in the code.
I have generated a log for getting the error values while displaying the images.
The doc file describing the behaviour while allocating the memory is attatched.
Following is the brief description of what I found with the log:
-> The heap available (using AEEDeviceInfo::dwRAM - IHEAP_GetMemStats())
gradually decreases each time the game is started.
-> At one stage the heap allocation failed (Page 1, line number 42).
-> After the heap allocation is failed, App_Cleanup message appeared and the
heap increased to normal.
-> After the heap increased to normal, subsequent memory allocations were
successful.
-> At a later stage (please see around the end of the log, Page 3, line number 6),
once again the heap allocation failed.
-> Again after the heap allocation failed, App_Cleanup message appeared and
the heap increased to normal.
-> But the largest contagious free block of memory was only 10KB even after
App_Cleanup.
-> But after the heap increased to normal, subsequent memory allocations failed
and here the images failed to load.
Please see the detatiled log file which is attatched alongwith.
The problems I am facing with the above behaviour are:
1) Heap available decreases each time the game is started.
2) Now if the Memory Management is performed that way (at istant when the
memory available is very less, if we try to allocate memory, the memory
available increases to normal and also the largest contagiuos block of memory),
then at this point of time memory allocation fails.
3) But when garbage collection / memory management is being performed
sometimes the largest contagious free block of memory doesnot increase to
normal and all the subsequent memory allocations fail.
Please suggest some solutions for these.
Thanks.

Hi,
I reviewed the code again and even tested it on the emulator and other devices. But it didn't seem to be having memory leaks in the code.
I have generated a log for getting the error values while displaying the images.
The doc file describing the behaviour while allocating the memory is attatched.
Following is the brief description of what I found with the log:
-> The heap available (using AEEDeviceInfo::dwRAM - IHEAP_GetMemStats())
gradually decreases each time the game is started.
-> At one stage the heap allocation failed (Page 1, line number 42).
-> After the heap allocation is failed, App_Cleanup message appeared and the
heap increased to normal.
-> After the heap increased to normal, subsequent memory allocations were
successful.
-> At a later stage (please see around the end of the log, Page 3, line number 6),
once again the heap allocation failed.
-> Again after the heap allocation failed, App_Cleanup message appeared and
the heap increased to normal.
-> But the largest contagious free block of memory was only 10KB even after
App_Cleanup.
-> But after the heap increased to normal, subsequent memory allocations failed
and here the images failed to load.
Please see the detatiled log file which is attatched alongwith.
The problems I am facing with the above behaviour are:
1) Heap available decreases each time the game is started.
2) Now if the Memory Management is performed that way (at istant when the
memory available is very less, if we try to allocate memory, the memory
available increases to normal and also the largest contagiuos block of memory),
then at this point of time memory allocation fails.
3) But when garbage collection / memory management is being performed
sometimes the largest contagious free block of memory doesnot increase to
normal and all the subsequent memory allocations fail.
Please suggest some solutions for these.
Thanks.

Any solution for the above described problem please .... .
Thanks.

Any solution for the above described problem please .... .
Thanks.

You might want to try building and running your code in BoundsChecker. This will find even the nastiest of overflow / leaks etc. Its well worth the money. Note, when you use it, you need to configure the emulator to use Windows Memory.
Link to BoundsChecker

You might want to try building and running your code in BoundsChecker. This will find even the nastiest of overflow / leaks etc. Its well worth the money. Note, when you use it, you need to configure the emulator to use Windows Memory.
Link to BoundsChecker

I am also facing the same problem of gradual memory reductin on audiovox8900 and 8910. Is there any means by which we could reset the memory usage by BREW or any work around to avoid this?

I am also facing the same problem of gradual memory reductin on audiovox8900 and 8910. Is there any means by which we could reset the memory usage by BREW or any work around to avoid this?

ZeroCool wrote:You might want to try building and running your code in BoundsChecker. This will find even the nastiest of overflow / leaks etc. Its well worth the money. Note, when you use it, you need to configure the emulator to use Windows Memory.
Link to BoundsChecker
Can you please let me know how do i set the BREW Simulator to use windows memory. I am trying to get bounds checker to work.

ZeroCool wrote:You might want to try building and running your code in BoundsChecker. This will find even the nastiest of overflow / leaks etc. Its well worth the money. Note, when you use it, you need to configure the emulator to use Windows Memory.
Link to BoundsChecker
Can you please let me know how do i set the BREW Simulator to use windows memory. I am trying to get bounds checker to work.

rookdev wrote:Can you please let me know how do i set the BREW Simulator to use windows memory. I am trying to get bounds checker to work.
To work on windows memory --> open the skin in Device Configurator > Click Details button > click the Heap check box (tha lablel will be "Use Windows Heap") and save the setting.

rookdev wrote:Can you please let me know how do i set the BREW Simulator to use windows memory. I am trying to get bounds checker to work.
To work on windows memory --> open the skin in Device Configurator > Click Details button > click the Heap check box (tha lablel will be "Use Windows Heap") and save the setting.