I currently think about an architecture for one-page mobile-web-apps, let them work offline with a lot of data.
My concern is that loading and keeping all data loaded in objects is wasting too much memory. I think about older android phones, iphones etc.
Would it be a good idea to start with variables initialized whith json-strings of data-model-objects, which i load/parse into an object when i need them?
i could free the loaded object as soon as the use of the model changes (of course only if its unlikely that the object is needed in the near future)
or are those string-variables hold in memory anyway, so i dont save memory?
What is the difference in memory consumption between a javascript object and its (stringyfied JSON-)String?
UPDATE:
i found the answer to the question in this article about javascript object size.
so comparing a json-string and its corresponding loaded object shows that the string is smaller. Thats what i expected.
Would it be better to retreive the strings via ajax and put them into localStorage? After the anonymous ajax callback finishes the GC could do its job...
is this even the right direction? what is the best approach keeping data like that?
I know all this is very vague, so any help is highly appreciated!