Out of memory
I'm on v 1.77. When I try to import my settings back up file it stops like in the middle of the process and gives me an java.lang.OutOfMemory error.
Out of memory errors cannot be fixes, they are what they are.
Ok, but I didn't have this problem with previous versions, actually until 1.75...
I guess you have set more restrictions since then.
Mmmmh, I see... So I will investigate, thanks for the info!!!
I have same issue with import. I have 16GB HTC One S with very moderate amount of apps: 199 in total - 55 user apps and 144 system apps, as reported by Titanium Backup. I have around 680MB of free internal storage and around 520MB of free RAM in everyday use. Currently, my XPrivacy xml file size is 303KB (yes, I have a lot of restrictions active). There are 3123 entries for all these apps - an average 15 per app. And each restriction added in XPrivacy app make my file bigger even if I don't change anything. I've tried to reinstall XPrivacy and Xposed, also tried to kill as many apps as possible to free more RAM but nothing helps. My workaround is to Titanium Backup to restore XPrivacy, but others may not have backup. I understand this is not strictly XPRivacy problem, but you might look at this issue. Users who have devices with less memory and/or more apps should be affected as soon as they start do dig deeper and apply more restrictions. I don't know anything about Android development, but have some programming background. My suggestions could be an educated guess at bwest, but here are two ideas:
- Instead of loading complete xml file in memory during the import, load the file in chunks of manageable size.
- Apply reverse logic on xml entries: all permissions and functions should be consider restricted (checked) by default and xml file will contain only unchecked (not restricted) items.
I will see how I can improve this. Hopefully I don't have to write my own XML parser and can the built-in parser be tweaked.
I will switch to the SAX parser to save memory. http://developer.android.com/reference/javax/xml/parsers/SAXParser.html
Could you please test if this version works okay for you: http://d-h.st/Eyb (if you have a file manager installed, there is a bonus ;-)
See also #327
Same error, but work longer than before.
Marcel Bokhorst [email protected] wrote:
Could you please test if this version works okay for you: http://d-h.st/Eyb (if you have a file manager installed, there is a bonus ;-)
Reply to this email directly or view it on GitHub: https://github.com/M66B/XPrivacy/issues/329#issuecomment-21537923
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
There is little more I can do than I already did, sorry.
Maybe change xprivacy to use a sql database. and export the data base as such.
May solve the memory errors and if you locate the database in /data like pdroid it will keep nosy and malicious apps out of it.
That would not be compatible across devices.
Doesnt just about every messaging app use SQL for its database? android includes sql as well as default. and 2.3+ allow the use of the WAL sql database system. It would probably improve the performance alot if this can be done.
Can you explain more why it would not be corss-device compatible? I dont understand why it wouldn't considering my above statements. As for putting it in /data your app will need rood access. but every one who uses exposed framework has to have root anyways. so no issues there.
There are different versions of SQLite database, depending on Android version.
well, you can address it the same way other devs do could you not? You could even include your own version of sql binary. alot of backup apps and tweaking apps do this already.
Too much work that I rather spent on something else (for example restricting Android 4.3)
Fair enough. But If this goes un solved, the inability to import ones settings is going to detour some users and pro users.
I don't have the issue "yet"
But keep in the back of your mind that this issue is fixable with my suggestion of moving to a sql database, and eventually people will expect it to be. I would make this "low prio", not "will not fix" in my opinion.
And again just to mention it would probably improve performance, which i know you have been aiming for.
@GhostlyCrowd An SQLite database doesn't necessarily use less memory. The situation with the new XML parser has greatly been improved. The memory footprint of the new parser is magnitudes lower that the old one.
@pogovault which device are you using and how much free memory do you have?
Also the answer to this stack overflow question hits the nail on the head for the issues your having
http://stackoverflow.com/questions/5213550/raw-resources-versus-sqlite-database/5213569#5213569
easier and faster to retrieve sort and filter data and it has none of the limitations you are getting with SAX or the previous xml parser.
As xprivacy grows so will the things its filtering, sorting and what not. I still suggest you consider this.
As devices become more powerful it will not be uncommon for a user to have 300-600 apps. So what then?
if users are having issues importing settings for 200-300 apps now. thi9nk about the future.