Additional problem, we almost forgot about, is indexing.
How it works:
1) At start of indexing it select from data base all files on the SD-card and create linked list of them(Huge memory load).
2) Then it creates linked list of all files on SD-card (Huge memory load)
3) Then for each file on disk it looks for (very slow) corresponding file on database list.
4) Compare it and mark if they different/missed/new
5) For every entry in data base list it apply changes if any.
So to speed up indexing, one should
1) Limit count of items in memory. Limit memory load.
2) speed up search items in database list. IMHO it's useless to select all items from data base and then search it this list, database does this faster.
3) Limit count of file items in memory: limit memory load from file list.