Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 275
Registered: ‎03-10-2009
My Device: Not Specified

programmatically recover leaked memory?

i feel like my device leaks memory. it just gets slower and slower over time until i have to restart it. Is there a programmatic way to recover leaked memory?

 

thanks

Developer
Posts: 905
Registered: ‎02-07-2009
My Device: BlackBerry Torch 9800
My Carrier: Globe Telecom

Re: programmatically recover leaked memory?

you can invoke System.gc() to initiate garbage collection, although this will not trigger garbagecollection right away. 

 

or you can use the BlackBerry JDE profiler to find the section where the leak is originating. Then optimize that part. 

Developer
Posts: 275
Registered: ‎03-10-2009
My Device: Not Specified

Re: programmatically recover leaked memory?

the JDE profiler? that can scan the whole device? note that im not talking about a single app that's leaking memory. I'm talking about the whole device itself.
Developer
Posts: 905
Registered: ‎02-07-2009
My Device: BlackBerry Torch 9800
My Carrier: Globe Telecom

Re: programmatically recover leaked memory?

ah i see. actually the device is already equiped with a LowMemoryLIstener where it automatically frees up the memory in case it detected a low memory. you can also try the System.gc().

 

you can also search for it manually and uninstall the particular application that causes the leak.Smiley Happy 

Developer
Posts: 275
Registered: ‎03-10-2009
My Device: Not Specified

Re: programmatically recover leaked memory?

i see. my friend has this Memory Booster, or whatever it's called, that claims to "recover memory" so applications open faster. i saw it on app world and it's very popular. im wondering how it works, or even if it works at all, but dont wanna pay $10 for it...
Developer
Posts: 905
Registered: ‎02-07-2009
My Device: BlackBerry Torch 9800
My Carrier: Globe Telecom

Re: programmatically recover leaked memory?

i searched for that application you mentioned. interesting! hmm... i'll look for something in the API. maybe its possible to programmatically clear the cache, etc. and free up resource or thread maybe. i'll keep you posted if ever i find something. Smiley Happy
Developer
Posts: 275
Registered: ‎03-10-2009
My Device: Not Specified

Re: programmatically recover leaked memory?

i did see some classes like Memory, MemoryStats, etc. but i didnt really find anything that would do what that app does.