reading large files into an array

dagnabitboy

Active Member
Licensed User
Longtime User
I need a little advice from the experts!! My app is a "hex" editor. Currently I read an entire file into a byte array so I can easily display, search and edit the data. When I dim more than about 10 megs I run into problems with the app stopping, especially when changing orientations, even though the variable is declared in process globals. And some files will be bigger than 10 megs of course. Is there a preferred or better way to handle large files? I'm hoping to avoid splitting the file up into chunks because that will obviously complicate things. Thanks!
 

bluejay

Active Member
Licensed User
Longtime User
Most phones only allocate 16MB to 22MB of heap memory to an App. Some high end phones allocate 32MB and low end ones could allocate as low as 12MB.

And each process is allocated 2MB of system memory.

OpenGL has access to all user memory in the phone for textures.

As Erel indicates you need to break large sets of data up into small chunks.

A similar problem occurs when trying manipulate large images so search for forum topics on large images.

While it possible add an entry to Manifest file to request 'Large Heap' there is no guarantee that the phone will actually allocate more memory.

bluejay
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…