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

Developer

Forums

Forums:

when my application allocate about 50k mem.
the simulator display following message:
"
APPLICATION ERROR
Memory corruption
MEMMOVE
"

Does my application access invalid mem?

How are you trying to allocate memory? I suppose you are using MALLOC(note the upper case). Just before calling MALLOC you can call IHEAP_CheckAvail to see if memory can be allocated. You can also call IHEAP_GetMemStats to see currently used memory.
regards
ruben

How are you trying to allocate memory? I suppose you are using MALLOC(note the upper case). Just before calling MALLOC you can call IHEAP_CheckAvail to see if memory can be allocated. You can also call IHEAP_GetMemStats to see currently used memory.
regards
ruben

Hi,
Please give us some code snippet so that we could find your problem exactly.......
If you allocate less memory and try to copy more memory using MEMCPY(), then these problem will occur.
Regards
V. Anand

Hi,
Please give us some code snippet so that we could find your problem exactly.......
If you allocate less memory and try to copy more memory using MEMCPY(), then these problem will occur.
Regards
V. Anand

A related question:
This IHEAP_CheckAvail(IHeap * pIHeap, uint32 dwSize) needs a pointer to IHeap. Does this pointer, if created through CreateInstance
(ISHELL_CreateInstance(pi->a.m_pIShell, AEECLSID_HEAP, (void **)&pIHeap)) points to the *same* heap as MALLOC() is doing allocation on?
Thanks for your help!

A related question:
This IHEAP_CheckAvail(IHeap * pIHeap, uint32 dwSize) needs a pointer to IHeap. Does this pointer, if created through CreateInstance
(ISHELL_CreateInstance(pi->a.m_pIShell, AEECLSID_HEAP, (void **)&pIHeap)) points to the *same* heap as MALLOC() is doing allocation on?
Thanks for your help!

You can create the IHEAP instance at the begining of your applet initilization. Then on you can check the memstatus whenever you want.
Please note that, it depends how you are managing your application memory.
If you are doing application's memory management of your own then you may be calling MALLOC once and acquire your application's total runtime memory and manage your application's memory. In this case your memory manager unit should have error handling/reporting mechanism.
On the other hand if you are using BREW memory managing unit, IHEAP functionalities would be very useful.
regards
ruben

You can create the IHEAP instance at the begining of your applet initilization. Then on you can check the memstatus whenever you want.
Please note that, it depends how you are managing your application memory.
If you are doing application's memory management of your own then you may be calling MALLOC once and acquire your application's total runtime memory and manage your application's memory. In this case your memory manager unit should have error handling/reporting mechanism.
On the other hand if you are using BREW memory managing unit, IHEAP functionalities would be very useful.
regards
ruben

Quote:Originally posted by ruben
On the other hand if you are using BREW memory managing unit, IHEAP functionalities would be very useful.Thanks Ruben. From what you're saying seems it's much better approach to use IHEAP_* methods for mem management, then use only MALLOC(), right? Especially if MALLOC() is using some other heap...

Quote:Originally posted by ruben
On the other hand if you are using BREW memory managing unit, IHEAP functionalities would be very useful.Thanks Ruben. From what you're saying seems it's much better approach to use IHEAP_* methods for mem management, then use only MALLOC(), right? Especially if MALLOC() is using some other heap...

Both the approach has it's own positive and negative point.
In the first approach, you have higher control over your appllication's behavior and the memory fragmentation issue. Often, handset manufacturer may want to work on this memory sand-box model, whereby your application gets a pre-determined amount of memory to work with. Disadvantage is that, it requires lot more coding and your application blocks a chunk of memory.
In the second approach, you have BREW memory management functionalities are available to your application, lot less coding but but your target device may suffer fragmentation problem.
regards
ruben

Both the approach has it's own positive and negative point.
In the first approach, you have higher control over your appllication's behavior and the memory fragmentation issue. Often, handset manufacturer may want to work on this memory sand-box model, whereby your application gets a pre-determined amount of memory to work with. Disadvantage is that, it requires lot more coding and your application blocks a chunk of memory.
In the second approach, you have BREW memory management functionalities are available to your application, lot less coding but but your target device may suffer fragmentation problem.
regards
ruben

How about ISHELL_OnLowRAMCritical() or ISHELL_OnLowRAM()?
IHEAP_CheckAvail() is beneficial or anyone from the above. Which can be recommended
Max, any idea.
Thanks
Anu

How about ISHELL_OnLowRAMCritical() or ISHELL_OnLowRAM()?
IHEAP_CheckAvail() is beneficial or anyone from the above. Which can be recommended
Max, any idea.
Thanks
Anu

Can anybody tell me which of them is good. ISHELL_OnLowRamCritical or IHEAP api. And if ISHELL_OnLowRAMCritical is good then how I can identify that my application is within AEEGROUPID_LOW_RAM?
Thanks
Shah

Can anybody tell me which of them is good. ISHELL_OnLowRamCritical or IHEAP api. And if ISHELL_OnLowRAMCritical is good then how I can identify that my application is within AEEGROUPID_LOW_RAM?
Thanks
Shah

Hi all,
Being new to BREW,I am not really clear about the memory structure in BREW.
In the BREW API_REFERENCE I came across ISHELL_GetDeviceInfo() ehich says that it tells about the total amount of memory. But what is this TOTAL MEMORY?
Is it the device memory or the memory allocated to one application?
And same question for IHEAP_GetMemStats() that says it returns the amount of memory in the system that is being used.

Hi all,
Being new to BREW,I am not really clear about the memory structure in BREW.
In the BREW API_REFERENCE I came across ISHELL_GetDeviceInfo() ehich says that it tells about the total amount of memory. But what is this TOTAL MEMORY?
Is it the device memory or the memory allocated to one application?
And same question for IHEAP_GetMemStats() that says it returns the amount of memory in the system that is being used.

Do the memory fragmentation problems I saw in the 2.x posts still happen in the 3.x environment?

Do the memory fragmentation problems I saw in the 2.x posts still happen in the 3.x environment?