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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Developer
rihan007
Posts: 449
Registered: ‎01-14-2009

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

Please use plain text.
Administrator
MSohm
Posts: 12,957
Registered: ‎07-09-2008
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.
Found a bug? Report it using the Issue Tracker
Please use plain text.
Developer
rihan007
Posts: 449
Registered: ‎01-14-2009

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?

 

 

Please use plain text.
Regular Contributor
prash_bb_dev
Posts: 68
Registered: ‎03-17-2010
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.

 

Or

 

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.

 

 

Please use plain text.
Developer
peter_strange
Posts: 17,702
Registered: ‎07-14-2008

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. 

Please use plain text.
Developer
rihan007
Posts: 449
Registered: ‎01-14-2009

Re: SizeOf Vector Object

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

 

Thanks

Please use plain text.