12-28-2012 02:15 AM
in my application when i open around 15-20 screens it throughts out of memory error. i saw the memory stats ram was occupying the to much memory how can i freze that memory is there any methods available in bb to clear the Ram memory. any one help me on this to solve the issue.
i am poping all screens but that one wasn't helping me here.
i tried to popall screens and push a new screen also not clearing the memory. it clears the screen data a little bit.
Thanks in advance.
12-28-2012 04:51 AM
Hai, You need to do few things to clear memory.
1.Pop up the current screens correctly after every push. Don't clos all screens on certain point.
2.Reuse the objects instead of creating new ones.
3.Don't use many String variables, Try to reduce and reuse the strings as it take more memory.
4.Try to reduce recursive functions repeatedly.
5.Use synchronized (UiApplication.getEventLock()) for Database connection it will reduce the time by lock the UI.
6.Try to reduce the Size of images with the help of graphic designer.
These are the simple steps to be concerned on development.
12-28-2012 06:56 AM
gopi has given you some good tips and ideas.
I just wanted to add that the profiler is a good way to find out what Objects you are hanging on to.
Remember that the garbage collector will tidy up the Objects that you are no longer using, but if it finds you still have a reference to it anywhere, it will not remove the Object.
In my experience, images tend to use more memory than anything else.