11-26-2009 10:26 AM
how about downloading the files?
11-26-2009 05:47 PM
"toString() won't do for .mp3 files, or could it ?"
Could do, if you really wanted.
"Then my app won't start because it's built as a dependency"
Then don't make it a dependency. But that also means separate installs.
The issue I have with your approach is the requirement to OTA install a large file. I have a similar requirement with an application, and am still grappling with the best approach. I'm tempted to provide them as a download and let the users install them onto their SDCard in whatever fashion best suits them and their data plan. So those concerned about megabytes used each month can take their SDCard out, download on the PC and stick them directly onto the SDCard themselves. Those that have the minutes to spare and no data limits can just download on the phone.
As I said, still up in the air about this, so very interested in any conclusions reached on this Thread.
11-27-2009 02:30 AM
Well my solution of choice is still a dependent library.
Understandable API, no hacking... Clean and simple.
My problem is not in the bandwidth cost but the resource memory consumption.
AFAIK application resources are put in memory when you run the application, right?
That's why I put them on file system, but, unfortunately, you cannot remove the resources so they fill up memory needlessly.
When exactly is a library loaded in memory (along with its resources) ?
The first time you invoke it or at the same time as the main application ?
Thank you for sharing your thoughts
11-27-2009 02:44 AM
Peter_Strange was wery kind to answer these questions on a related thread:
[separate library had 2MB of resources]
1) When are the 2MB allocated in memory ?
2) How to avoid that ?
3) I don't need the resources from the lib after first invocation, is there a way to 'release' resources ?
4) Is there a way to 'flush' library after using it, or will GC take care of that ?
2) Don't understand this question. Aside from memory what else do you have on a BlackBerry?
3) Delete the cod - CodeModuleManager will help you here I think
4) See 3 - the garbage Collector won't help.
I would like to fill in the blanks...
It seems I don't understand.
Please bear with me.
a ) I know applications are stored in flash. But your answer (1) suggests that there is no concept of RAM on BB ? I thought application/library was loaded from flash to RAM when started. Please confirm/deny.
b) If there is a separate flash-RAM architecutre on BB, when is a library loaded into RAM and is there a way to clear it out ?
c) Answer (3) is unusable in case of dependant library since the main app cannot start if the dependancy is deleted/uninstalled, right?
d) too bad GC cannot help me, since I am using the library only once on every application startup, and the app is a background app.
Thanks fo your efforts Peter
11-27-2009 04:09 AM
I have made two different scenarios and have calculated the difference in Memory consumption.
Context: Main app uses a Library app.
1) Library app has no resources attached
2) Library app has arround 4MB of resources (several files) attached
This is the result of my testing ( 2 -1 ):
Memory Statistic # objects Bytes in use Allocated Free Object Handles 0 -4463884 -10863 10863 RAM -10997 -4348636 -4305016 4306636 Flash 134 -115248 4277928 -4278716 Transient objects (flash) -265 -99940 -6784 -4278716 Persistent objects (flash) -159 -15308 -15308 -4278716 Code modules (flash) 558 0 4300020 -4278716
The results clearly indicate that cod modules now use up more flash. But how come RAM allocation decreased? (Please ignore the fact that the decrease in RAM allocation size is very similar to the resources size because I reproduced the test and had diffent footprint - but again a significant decrease!)
So the conclusion is quite strange:
The Flash allocation has (obvoiusly) increased, but RAM allocation has decreased !?
Well I guess I just have to live with the fact that I cannot do anythig about it
Please leave any comments if you want to discuss the topic any further.
11-27-2009 04:17 AM
Just want to confirm one thing.
I have suggested that you don't make the Library a dependency. To do this, you need to find some non dependent way to get the data out of the Library, such as creating an instance of a Class and then using a toString().
If you did this, then you could get rid of the module, but the user would have to do separate install. So there are two downsides:
a) two Installs
b) some work on the toString method to create a String that can be turned back into whatever you want.
If you do not do this, then, as far as I can see, you can give up on the idea of shipping the data in a cod that may subsequently be deleted.
Is this clear?
12-02-2009 02:46 AM
Not the solution I hoped for but you sure hit the point i was trying to make.
The only drawback is that the toString is a one-way communication, that means that the app has to
take all the resources at once an at first shot.
But atleast it's doable.
Thanks all !