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

Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.

Posts: 455
Registered: ‎01-14-2009
My Device: Apple iPhone 3GS 16GB

SizeOf Vector Object

hello friends,


How do i calculate the size of vector object being persisted to persistant store.? I want to know how much space the vector object utilises in the persistant store, How do i find out? Please help



thanks guys

BlackBerry Development Advisor
Posts: 15,885
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: SizeOf Vector Object

There are no methods to determine this programmatically.  However, you can use the memory statistics tools in the BlackBerry Java Plug-in for Eclipse and BlackBerry JDE to observe this while debugging.  You can refer to the BlackBerry Memory Statistics and BlackBerry Object views within Eclipse.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Posts: 455
Registered: ‎01-14-2009
My Device: Apple iPhone 3GS 16GB

Re: SizeOf Vector Object

Hi mark thanks for the reply.


My intention is to show the user how much memory the app is using in persistant store. Say for example the app allows to download mp3 and store in persistant store. So the user can see how much space the objects stored in persistant store are using up and clear the persistant store if they want to.


Is there any way they can do it?



Regular Contributor
Posts: 68
Registered: ‎03-17-2010
My Device: 9000,9500,8900
My Carrier: Airtel,Vodafone

Re: SizeOf Vector Object

Mark is right. 


There is no direct way we can calculate exact memory of persisted object.


Assuming that you just want to care about the storage of your application alone. You can fetch the persistence memory accessing the key and fetching the vector from that memory.


After than


Either you can count vector's size. and easily show number of objects stored in memory.




Fetch every object from vector. Count the bytes and convert them into mb and show them, but afaik it will not be convenient way, neither we can get perfact data.



Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: SizeOf Vector Object

Agree with prash_bb_dev.


I would also encourage you to store large byte image type files, like MP3s, on the SD Card and not in persistent store. 

Posts: 455
Registered: ‎01-14-2009
My Device: Apple iPhone 3GS 16GB

Re: SizeOf Vector Object

yes peter. and as i said earlier mp3 was an example.