Paru
Paru

Reputation: 57

Where sharedPreference value will be stored in Android?

I'm using sharedPreference in Android, but in which memory it will be stored like heap memory or stack memory? How much amount of data we can store in sharedPreference for better experience.

Upvotes: 0

Views: 512

Answers (2)

Remario
Remario

Reputation: 3863

Stack is used for static memory allocation and Heap for dynamic memory allocation, both stored in the computer's RAM .Therefore shared preferences are heap based.

Variables allocated on the heap have their memory allocated at run time and accessing this memory is a bit slower, but the heap size is only limited by the size of virtual memory .

Upvotes: 0

Rohan Sharma
Rohan Sharma

Reputation: 394

SharedPreferences are stored in an XML file and and they are stored in heap memory it throw a Memory Exception when SharedPreference data exceed 1.42 MB. you can refer to this stackoverflow link for more details. Shared Preferences "limit"

Upvotes: 1

Related Questions