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

Developer

Forums

Forums:

Hi All,
I am developing an application, which manipulates the data, sending it to server and get back the response. During this process, for the manipulation i need to allocate huge memory. Say while loading my application, the initial size of the memory in use is - 60517 (got using IHEAP_GetMemStats())
After manipulation - 75321 (due to dynamic allocatio of memory)
After getting the data from the server, i am freeing all the dynamically allocated memroy. Hence the resultant memory that is in use is 60517.
So, in the above process i am allocating the memory and releasing it and got the same memory.
But when i try to create an instance for IImage, it is hanging.
1) Is there any problem with fragmentation. ?
2) Again, function IHEAP_CheckAvail() with 600 is returning false. So, it says there's no memory for allocation.
3) But if i don't the process which imentioned again, my program works perfectly.
Please suggest me a work around for the same.

Regards
V. Anand

I have encountered problems with BREW memory manager, and I am not sure how robust it is.
My suspision would be memory fragmentation. I would recommend that you use your own heap manager(at the begining of your application, make one Malloc call and get all the necessary memory and then override "new" and "delete" functions so that all your applicaiton new and delete call goes to your custom memory allocator, ) and at the end of your application release your memory. We have a large and very complicated application which uses this mechanism and works fine in real BREW device.
regards
ruben

I have encountered problems with BREW memory manager, and I am not sure how robust it is.
My suspision would be memory fragmentation. I would recommend that you use your own heap manager(at the begining of your application, make one Malloc call and get all the necessary memory and then override "new" and "delete" functions so that all your applicaiton new and delete call goes to your custom memory allocator, ) and at the end of your application release your memory. We have a large and very complicated application which uses this mechanism and works fine in real BREW device.
regards
ruben

Would you like to explain it further-- it will be great if you can give some high-level pseudo code (if not the original code :-))

Would you like to explain it further-- it will be great if you can give some high-level pseudo code (if not the original code :-))

Many wireless carriers/OEM vendors prefers application to work with a given amount of memory.
In our application we have memory manager which is initialized at the application startup and provides with a specified amount of memory. We have global overloaded version of new/delete. These overloaded version of new/delete gets memory from our memory manager.
At the end of your appplication you deallocate memory given to the application memory manager.
ruben

Many wireless carriers/OEM vendors prefers application to work with a given amount of memory.
In our application we have memory manager which is initialized at the application startup and provides with a specified amount of memory. We have global overloaded version of new/delete. These overloaded version of new/delete gets memory from our memory manager.
At the end of your appplication you deallocate memory given to the application memory manager.
ruben

great. I was about to do the same thing but one question stopped me. what would be the case with ISHELL_LoadResXXX operations ? Do they use your custom memory manager ? If "yes", how is it hooked ? For an application that loads say, images, it would be great to have a custom memory manager hooked ?? I dont know if this is a question and whether it makes sense. !@!@^&* "Rambling" @@###

great. I was about to do the same thing but one question stopped me. what would be the case with ISHELL_LoadResXXX operations ? Do they use your custom memory manager ? If "yes", how is it hooked ? For an application that loads say, images, it would be great to have a custom memory manager hooked ?? I dont know if this is a question and whether it makes sense. !@!@^&* "Rambling" @@###