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: 241
Registered: ‎11-20-2008
My Device: Not Specified
Accepted Solution

Available Memory With Memory API : Is it accurate?

[ Edited ]
I am using the following calls to check the available memory.
Memory.getFlashStats().getFree()
Memory.getRAMStats().getFree()


However, I am confused with what the Api reports. For a code segment like below, at the end I am getting zero difference (available flash or ram do not change). Is this expected? I expected to see 1024 less available ram or flash.



past_available_flash = Memory.getFlashStats().getFree();
past_available_ram = Memory.getRAMStats().getFree();

bytes = new byte[1024];

current_available_flash = Memory.getFlashStats().getFree();
current_available_ram = Memory.getRAMStats().getFree();

difference_available_flash = current_available_flash - past_available_flash;
difference_available_ram = current_available_ram - current_available_flash;


Message Edited by cagdasgerede on 04-01-2009 05:30 PM
Developer
Posts: 241
Registered: ‎11-20-2008
My Device: Not Specified

Re: Available Memory With Memory API : Is it accurate?

Any suggestions on this? I still need to answer this.
Appreciate any help.
BlackBerry Development Advisor
Posts: 15,083
Registered: ‎07-09-2008
My Device: BlackBerry Passport
My Carrier: Bell

Re: Available Memory With Memory API : Is it accurate?

You'll need to give it a bit more time for the memory stats to be updated.  If you insert a short sleep after creating the byte array you should see the values have decreased.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker