Reputation: 31
I have an issue in Java that I've been going at for about a week. I'm trying to find an efficient way to write around 90-120MB a second to external storage on Android without dropping data. In my test I have been getting 18-20MB/s which is the normal speed range for the external storage, however since the heap in Android per process is 140MB-256MB (I get 138MB max using largeHeap flag) it's impossible to make a large enough buffer to keep the data in tact using Java linked list or arrays (the data is generated at 90+MB/s). Is JNI a good option to create a large enough circular array or linked list to keep the data while the file write catches up? I saw another post where someone suggested making a service run in a separate process to get "extra" memory . I'm just worried about serialization slowing down the transfer of the generated data. I've deleted all of my code so far in frustration. Thanks in advance.
Upvotes: 2
Views: 808
Reputation: 533510
To write 90-120 MB/s you need a device which supports this data rate. Note: a typical HDD can't do this much.
You can add some extra buffering but this is not sustainable. I suggest instead you find a way to write the same information in less data. e.g. by compressing the data.
BTW JNI won't make your device run faster, or give you more memory.
Upvotes: 1