Out of memory with big data in codename

My Codename One application downloads about 16,000 data records (approximately 10 fields per record).

On my Android phone (OS6.0, RAM 2GB) it can download 8000-9000 records, but then it shows an error in memory.

From the trace, it looks like an application has been allocated from heap memory.

Any suggestion on what would be the ideal way to handle this large amount of data please?

Here is the log file

+3


source to share


2 answers


The amount of RAM on a phone doesn't mean much. The OS takes up about half and then divides the rest into various applications running in parallel. You usually have a lot less. What is the maximum amount of RAM an application can use?



You need to go through your code and check what memory is driving. 16k entries of 1kb each would be 16Mb which probably shouldn't crash the application, so the question is where is the memory taken from, I would suggest reading the performance section of the developer guide to figure out memory usage.

+2


source


This may not apply to your situation, but is it possible to download only x number of records at a time? Then when the user takes some action (scrolls, next page hits, etc.), does he load the next batch? Codename has a great endless scrolling implementation. See here for an example - https://www.codenameone.com/blog/property-cross-revisited.html



+2


source







All Articles