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

Developer

Forums

Forums:

I created an app with my own menu control in it...
I use a device pack with low memory/heap size (256000 bytes) in my simulator...
and I found something strange in it...

every time I scroll on my menu, the memory decreases and at some point it restores again, and so on...(I don't know how to show it)
all of the function still seems to work normally, but at a point where the memory free is about 1000 bytes, the images I use in my app suddenly won't appear and my simulator isn't responding and has to be closed...

I have looked through my code and it seems nothing wrong in it...
I only use interface IStatic, IImageCtl, and IImage...
and in each function I have reset the control first, and in the end release the interface...

anyone can explain to me about this "phenomenon"??
anyone ever experienced the same??
maybe anyone can help me solve this problem??

thank you in advance...

Can you please post the offending code? When you exit the applicaton do you get BPOINT memory leak messages in the output window?
-Karthik

Can you please post the offending code? When you exit the applicaton do you get BPOINT memory leak messages in the output window?
-Karthik

here is the code...
no, I don't get the BPOINT message...
I have tried to capture the simulation:
see the video here
take a look at the memory status...

here is the code...
no, I don't get the BPOINT message...
I have tried to capture the simulation:
see the video here
take a look at the memory status...

I do not see anything unusual in your source. However, I doubt the IIMAGECTL interface might be responsible for the leak. Can you comment the title draw function and check if it is still leaking the memory.
-Karthik

I do not see anything unusual in your source. However, I doubt the IIMAGECTL interface might be responsible for the leak. Can you comment the title draw function and check if it is still leaking the memory.
-Karthik

I've tried it, but it still the same...
but when I commented on the functions that use the IStatic interface there's no memory leak (e.g WriteText)...
so is it caused by the IStatic??what should be fixed then??

I've tried it, but it still the same...
but when I commented on the functions that use the IStatic interface there's no memory leak (e.g WriteText)...
so is it caused by the IStatic??what should be fixed then??

i think the problem is bcoz ur creating and releasing instance for AEECLSID_STATIC
too many times(ie dat function is called many times,FRAGMENTATION MIGHT BE THE PROBLEM), check out if u can create it once and release it at the end....

i think the problem is bcoz ur creating and releasing instance for AEECLSID_STATIC
too many times(ie dat function is called many times,FRAGMENTATION MIGHT BE THE PROBLEM), check out if u can create it once and release it at the end....

This is the first time I have heard about memory leak by using IStatic. You might want to do a little bit of research to fix the problem. Try to isolate the leaking function, e.g try to call WriteText and use IHEAP_GetMemStats() before and after calling WriteText function and check how bytes it is leaking, remove the API's one by one to fix the memory leak on a particular sequence or a API.
Good luck.
- Karthik

This is the first time I have heard about memory leak by using IStatic. You might want to do a little bit of research to fix the problem. Try to isolate the leaking function, e.g try to call WriteText and use IHEAP_GetMemStats() before and after calling WriteText function and check how bytes it is leaking, remove the API's one by one to fix the memory leak on a particular sequence or a API.
Good luck.
- Karthik

thank you very much for your helps...
can you show me some examples to use the IHEAP_GetMemStats()??
I tried using DBGPRINTF ("%d", IHEAP_GetMemStats(IHeap)) before and after WriteText function and the memory usage increases after it's called...
in the DisplayTitle function, the memory usage before and after is the same...
I have tried to use the IHEAP_GetMemStats() inside of the function, it seems the memory increases quite significantly when the ISTATIC_SetText() and ISTATIC_Redraw() is called, but why isn't it freed after the interface is released?
I did the same in the DisplayTitle functions, and there's also nothing changes after the interface is released...
so why in the DisplayTitle function there's no leaking but there is leaking in the WriteText?
I still don't get it...

thank you very much for your helps...
can you show me some examples to use the IHEAP_GetMemStats()??
I tried using DBGPRINTF ("%d", IHEAP_GetMemStats(IHeap)) before and after WriteText function and the memory usage increases after it's called...
in the DisplayTitle function, the memory usage before and after is the same...
I have tried to use the IHEAP_GetMemStats() inside of the function, it seems the memory increases quite significantly when the ISTATIC_SetText() and ISTATIC_Redraw() is called, but why isn't it freed after the interface is released?
I did the same in the DisplayTitle functions, and there's also nothing changes after the interface is released...
so why in the DisplayTitle function there's no leaking but there is leaking in the WriteText?
I still don't get it...

Your use of IHEAP_GetMemStats is fine.
I don't know why it is happening but you can try IDISPLAY_DrawText instead of ISTATIC or else try to store the strings in a resource file and use it. Do you have this issue in handset too?
-Karthik

Your use of IHEAP_GetMemStats is fine.
I don't know why it is happening but you can try IDISPLAY_DrawText instead of ISTATIC or else try to store the strings in a resource file and use it. Do you have this issue in handset too?
-Karthik

I have tried using IDISPLAY_DrawText but it's still the same...
I wonder if it may be caused of the event (key pressed) handling??
I haven't tried it in the handset...

I have tried using IDISPLAY_DrawText but it's still the same...
I wonder if it may be caused of the event (key pressed) handling??
I haven't tried it in the handset...

I suggest you try the applicaion in a actual phone before coming into a conclusion.
-Karthik

I suggest you try the applicaion in a actual phone before coming into a conclusion.
-Karthik