I am inserting 1,00,000 records into databse through background thread.at this time when I want load Ui screens I am getting Out of memory error.For example When the Heap size is 5 MB and 4MB is allotted to background threads,2 MB is required for loading UI screen.So in this scenario I am getting Out of memory issue.Please tell me what I need to do here to fix out of memory issue.
I am inserting 1,00,000 records into databse through background thread.at this time when I
Share
Try inserting 100 at a time instead of 1,000 at a time. That should cut your background thread’s memory usage by quite a bit.
If your records are coming from the server as XML, don’t use a DOM parser; it is a memory hog. Use a SAX, StAX, or pull parser instead.
Finally, be sure that you aren’t keeping references to objects that you don’t need once the records are inserted.