I/utter_travelin(31159): Clamp target GC heap from 53MB to 48MB
I/utter_travelin(31159): Forcing collection of SoftReferences for 64KB allocation
I/utter_travelin(31159): Starting a blocking GC Alloc
I/utter_travelin(31159): Clamp target GC heap from 53MB to 48MB
I/utter_travelin(31159): Alloc concurrent copying GC freed 20(712B) AllocSpace objects, 0(0B) LOS objects, 0% free, 47MB/48MB, paused 5us total 7.039ms
I/utter_travelin(31159): WaitForGcToComplete blocked Background on HeapTrim for 6.238ms
W/utter_travelin(31159): Throwing OutOfMemoryError "Failed to allocate a 65552 byte allocation with 53984 free bytes and 52KB until OOM, target footprint 50331648, growth limit 50331648" (VmSize 9934428 kB)
E/AndroidRuntime(31159): FATAL EXCEPTION: pool-1-thread-1
E/AndroidRuntime(31159): Process: com.example.flutter_traveling, PID: 31159
E/AndroidRuntime(31159): java.lang.OutOfMemoryError: Failed to allocate a 65552 byte allocation with 53984 free bytes and 52KB until OOM, target footprint 50331648, growth limit 50331648
E/AndroidRuntime(31159): at com.android.internal.util.FastXmlSerializer.<init>(FastXmlSerializer.java:86)
E/AndroidRuntime(31159): at com.android.internal.util.FastXmlSerializer.<init>(FastXmlSerializer.java:75)
E/AndroidRuntime(31159): at com.android.internal.util.XmlUtils.writeMapXml(XmlUtils.java:195)
E/AndroidRuntime(31159): at android.app.SharedPreferencesImpl.writeToFile(SharedPreferencesImpl.java:778)
E/AndroidRuntime(31159): at android.app.SharedPreferencesImpl.access$900(SharedPreferencesImpl.java:55)
E/AndroidRuntime(31159): at android.app.SharedPreferencesImpl$2.run(SharedPreferencesImpl.java:647)
E/AndroidRuntime(31159): at android.app.SharedPreferencesImpl.enqueueDiskWrite(SharedPreferencesImpl.java:666)
E/AndroidRuntime(31159): at android.app.SharedPreferencesImpl.access$100(SharedPreferencesImpl.java:55)
E/AndroidRuntime(31159): at android.app.SharedPreferencesImpl$EditorImpl.commit(SharedPreferencesImpl.java:585)
E/AndroidRuntime(31159): at io.flutter.plugins.sharedpreferences.MethodCallHandlerImpl$1.run(MethodCallHandlerImpl.java:143)
E/AndroidRuntime(31159): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
E/AndroidRuntime(31159): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
E/AndroidRuntime(31159): at java.lang.Thread.run(Thread.java:919)
I/utter_travelin(31159): Clamp target GC heap from 53MB to 48MB
W/System (31159): A resource failed to call close.
I/Process (31159): Sending signal. PID: 31159 SIG: 9
Lost connection to device.
Exited (sigterm)
Device keeps disconnecting from flutter, I don't know why, please help
In the Android simulator, this phenomenon is occurring continuously, and in ios, it works without any problem.
The Error Log shows
Throwing OutOfMemoryError
If you run your project on an emulator please clean it or uninstall your app.
Related
I have run into a use-case for my app where I need to insert ~1000 records. My app is running into OOM now.
#Insert(onConflict = OnConflictStrategy.REPLACE)
abstract fun insertAll(items: List<ItemEntity>)
I have tried:
bookEntityList.asSequence().chunked(50).forEach {
bookDao.insertAll(it)
}
But this does not work either. What is the best way to make such large inserts?
Here are the logs that I see:
2020-06-04 14:27:44.161 Background concurrent copying GC freed 4588(320KB) AllocSpace objects, 0(0B) LOS objects, 0% free, 95MB/96MB, paused 231us total 446.242ms
2020-06-04 14:27:44.161 WaitForGcToComplete blocked Alloc on HeapTrim for 445.238ms
2020-06-04 14:27:44.161 Starting a blocking GC Alloc
2020-06-04 14:27:44.162 WaitForGcToComplete blocked Alloc on HeapTrim for 443.251ms
2020-06-04 14:27:44.162 Starting a blocking GC Alloc
2020-06-04 14:27:44.162 WaitForGcToComplete blocked Alloc on HeapTrim for 14.494ms
2020-06-04 14:27:44.162 Starting a blocking GC Alloc
2020-06-04 14:27:44.190 Waiting for a blocking GC Alloc
2020-06-04 14:27:44.190 Waiting for a blocking GC Alloc
Stacktrace:
java.lang.OutOfMemoryError: Failed to allocate a 1496 byte allocation with 328 free bytes and 328B until OOM, max allowed footprint 100663296, growth limit 100663296
at android.icu.impl.ICUBinary.getShorts(ICUBinary.java:673)
at android.icu.text.RBBIDataWrapper.get(RBBIDataWrapper.java:248)
at android.icu.text.RuleBasedBreakIterator.getInstanceFromCompiledRules(RuleBasedBreakIterator.java:95)
at android.icu.text.BreakIteratorFactory.createBreakInstance(BreakIteratorFactory.java:155)
at android.icu.text.BreakIteratorFactory.createBreakIterator(BreakIteratorFactory.java:73)
at android.icu.text.BreakIterator.getBreakInstance(BreakIterator.java:836)
at android.icu.text.BreakIterator.getWordInstance(BreakIterator.java:565)
at java.text.BreakIterator.getWordInstance(BreakIterator.java:457)
at android.view.textclassifier.SelectionSessionLogger.getTokenIterator(SelectionSessionLogger.java:234)
at android.widget.SelectionActionModeHelper$SelectionMetricsLogger.<init>(SelectionActionModeHelper.java:688)
at android.widget.SelectionActionModeHelper$SelectionTracker.<init>(SelectionActionModeHelper.java:498)
at android.widget.SelectionActionModeHelper.<init>(SelectionActionModeHelper.java:92)
at android.widget.Editor.getSelectionActionModeHelper(Editor.java:2161)
at android.widget.Editor.sendOnTextChanged(Editor.java:1358)
at android.widget.TextView.sendOnTextChanged(TextView.java:9800)
at android.widget.TextView.setText(TextView.java:5760)
at android.widget.TextView.setText(TextView.java:5598)
at android.widget.EditText.setText(EditText.java:122)
at android.widget.TextView.setText(TextView.java:5555)
at android.widget.TextView.setTransformationMethod(TextView.java:2441)
at android.widget.TextView.applySingleLine(TextView.java:9493)
at android.widget.TextView.<init>(TextView.java:1460)
at android.widget.EditText.<init>(EditText.java:88)
at android.widget.EditText.<init>(EditText.java:84)
at androidx.appcompat.widget.AppCompatEditText.<init>(AppCompatEditText.java:69)
at androidx.appcompat.widget.AppCompatEditText.<init>(AppCompatEditText.java:65)
at androidx.appcompat.app.AppCompatViewInflater.createEditText(AppCompatViewInflater.java:192)
at androidx.appcompat.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:114)
at androidx.appcompat.app.AppCompatDelegateImpl.createView(AppCompatDelegateImpl.java:1266)
at androidx.appcompat.app.AppCompatDelegateImpl.onCreateView(AppCompatDelegateImpl.java:1316)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:772)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
I got the crash FATAL EXCEPTION: FrescoDecodeExecutor-2
Throwing OutOfMemoryError "Failed to allocate a 64256268 byte allocation with 16777216 free bytes and 49MB until OOM"
StackTrace :
java.lang.OutOfMemoryError: Failed to allocate a 64256268 byte allocation with 16777216 free bytes and 49MB until OOM
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.Bitmap.nativeCreate(Native Method)
at android.graphics.Bitmap.createBitmap(Bitmap.java:905)
at android.graphics.Bitmap.createBitmap(Bitmap.java:882)
at android.graphics.Bitmap.createBitmap(Bitmap.java:849)
at com.facebook.imagepipeline.memory.BitmapPool.alloc(BitmapPool.java:51)
at com.facebook.imagepipeline.memory.BitmapPool.alloc(BitmapPool.java:26)
at com.facebook.imagepipeline.memory.BasePool.get(BasePool.java:255)
at com.facebook.imagepipeline.platform.ArtDecoder.decodeStaticImageFromStream(ArtDecoder.java:147)
at com.facebook.imagepipeline.platform.ArtDecoder.decodeJPEGFromEncodedImage(ArtDecoder.java:127)
at com.facebook.imagepipeline.decoder.DefaultImageDecoder.decodeJpeg(DefaultImageDecoder.java:173)
at com.facebook.imagepipeline.decoder.DefaultImageDecoder$1.decode(DefaultImageDecoder.java:56)
at com.facebook.imagepipeline.decoder.DefaultImageDecoder.decode(DefaultImageDecoder.java:119)
at com.facebook.imagepipeline.producers.DecodeProducer$ProgressiveDecoder.doDecode(DecodeProducer.java:254)
at com.facebook.imagepipeline.producers.DecodeProducer$ProgressiveDecoder.access$300(DecodeProducer.java:113)
at com.facebook.imagepipeline.producers.DecodeProducer$ProgressiveDecoder$1.run(DecodeProducer.java:152)
at com.facebook.imagepipeline.producers.JobScheduler.doJob(JobScheduler.java:202)
at com.facebook.imagepipeline.producers.JobScheduler.access$000(JobScheduler.java:22)
at com.facebook.imagepipeline.producers.JobScheduler$1.run(JobScheduler.java:73)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at com.facebook.imagepipeline.core.PriorityThreadFactory$1.run(PriorityThreadFactory.java:51)
at java.lang.Thread.run(Thread.java:761)
Image is 5,34 Mo big 5344x3006 and was shoot by the phone Motorola XT1562, Android 7.1.1
implementation 'com.facebook.fresco:fresco:1.9.0'
Of course it does not reproduced every time the app is running
What's wrong ? Help ! :-)
I'm getting some non fatal errors on my logcat but no line numbers or anything else that can help me locate the error.
As you can see, I'm getting several, including Cursor finalized without prior close() and Window is full, but no idea how to find them.
09-26 14:20:47.743: W/CursorWindow(2090): Window is full: requested allocation 756 bytes, free space 150 bytes, window size 2097152 bytes
09-26 14:20:48.151: D/dalvikvm(2090): GC_FOR_ALLOC freed 1686K, 3% free 90204K/92076K, paused 108ms, total 112ms
09-26 14:20:48.159: W/CursorWrapperInner(2090): Cursor finalized without prior close()
09-26 14:20:48.163: W/CursorWrapperInner(2090): Cursor finalized without prior close()
09-26 14:20:49.759: D/dalvikvm(2090): GC_FOR_ALLOC freed 910K, 2% free 91343K/92436K, paused 115ms, total 115ms
09-26 14:20:51.127: D/dalvikvm(2090): GC_FOR_ALLOC freed 731K, 1% free 92661K/93576K, paused 70ms, total 70ms
09-26 14:20:52.195: D/dalvikvm(2090): GC_FOR_ALLOC freed 683K, 1% free 94024K/94892K, paused 71ms, total 71ms
09-26 14:20:53.303: D/dalvikvm(2090): GC_FOR_ALLOC freed 713K, 1% free 95360K/96256K, paused 77ms, total 77ms
09-26 14:20:54.403: D/dalvikvm(2090): GC_FOR_ALLOC freed 706K, 1% free 96702K/97592K, paused 84ms, total 84ms
09-26 14:20:54.755: W/CursorWindow(2090): Window is full: requested allocation 756 bytes, free space 645 bytes, window size 2097152 bytes
09-26 14:20:55.559: D/dalvikvm(2090): GC_FOR_ALLOC freed 752K, 1% free 98000K/98936K, paused 76ms, total 76ms
Any tips?
Thanks!
This kind of errors are not exceptions thrown by the program and will therefore not contain a stack-trace. As a general rule of thumb you may find ways to optimize your code by carefully reading the error message and read into the subject concerning the error.
As far as I can see it is a problem with allocation of memory. I don't think you can pinpoint them to a specific position in your execution flow since it will probably occur at different points in execution. You can think about your code to see if you can find some memory optimization possibilities.
If you want to analyze your code thoroughly you may want to use a tool like 'Eclipse MAT'. Read this tutorial to learn how to use the tool
Do a global file search looking for text like ".query(" in your .java files.
That should lead you to places where a Cursor is returned and from there you should be able to determine where they are not being closed.
I have written a game in Java for the Android platform which is currently undergoing thorough testing before it's release. It's all looking good in terms of bugs fixed, etc. but the thing which is troubling me at the moment is the memory usage.
It all looks fine when executing on an emulator hosting Android 2.3.3 with 16MB VM Heap as you can see from the following log dumps:
Just after booting up before starting my game:
05-23 15:11:43.422: DEBUG/dalvikvm(133): GC_EXPLICIT freed 81K, 50% free 2873K/5703K, external 6185K/6640K, paused 44ms
05-23 15:11:45.222: DEBUG/dalvikvm(60): GC_EXPLICIT freed 164K, 45% free 4104K/7431K, external 4373K/5573K, paused 76ms
After starting my game:
05-23 15:12:40.762: DEBUG/dalvikvm(314): GC_EXTERNAL_ALLOC freed 104K, 50% free 2833K/5575K, external 5104K/5748K, paused 46ms
05-23 15:12:41.143: DEBUG/dalvikvm(314): GC_EXTERNAL_ALLOC freed 10K, 50% free 2841K/5575K, external 6046K/6103K, paused 46ms
05-23 15:12:42.202: DEBUG/dalvikvm(314): GC_EXTERNAL_ALLOC freed 79K, 49% free 2925K/5639K, external 7656K/7658K, paused 46ms
So, from those entries it seems that I have around 50% available memory to use.
--
Now, when I start an emulator hosting Android 4.1.2 with 32MB VM Heap, the values I see from the logs are somewhat disappointing:
Just after booting up before starting my game:
05-23 15:08:32.566: DEBUG/dalvikvm(149): GC_CONCURRENT freed 530K, 6% free 9763K/10375K, paused 16ms+19ms, total 132ms
05-23 15:08:32.946: DEBUG/dalvikvm(149): GC_CONCURRENT freed 913K, 10% free 9786K/10823K, paused 16ms+27ms, total 128ms
After starting my game:
05-23 15:09:25.706: DEBUG/dalvikvm(618): GC_CONCURRENT freed 418K, 3% free 20563K/21063K, paused 18ms+19ms, total 118ms
05-23 15:09:25.706: DEBUG/dalvikvm(618): WAIT_FOR_CONCURRENT_GC blocked 38ms
05-23 15:09:26.316: DEBUG/dalvikvm(618): GC_FOR_ALLOC freed 557K, 4% free 21761K/22599K, paused 55ms, total 75ms
The amount of free memory hover around the 4%-10% mark despite the fact that this emulator has twice the amount of memory.
Initially, I thought it may be because the background graphic I am loading is larger (1280x800 pixels vs 800x480 pixels) but disproved this by removing the code that loads the background graphics and noticed that the amount of free memory remained the same.
Maybe I'm just paranoid and there isn't actually a problem because from the above logs it seems that immediately after booting up, the Android 4.1.2 instance reports between 6% and 10% of free memory anyway.
I have also added some manual memory usage logging for when the game was running on the Android 4.1.2 emulator. You will see from the following log entries, I have included the methods I used to obtain the values (e.g. Runtime.getRuntime().totalMemory()) :
05-23 15:09:26.386: DEBUG/Memory Usage(618): Heap Limit: 32(amount to stay within)
05-23 15:09:26.386: DEBUG/Memory Usage(618): Heap
05-23 15:09:26.386: DEBUG/Memory Usage(618): - Current Total: 23863264 (Runtime.getRuntime().totalMemory())
05-23 15:09:26.386: DEBUG/Memory Usage(618): - Maximum: 33554432 (Runtime.getRuntime().maxMemory())
05-23 15:09:26.386: DEBUG/Memory Usage(618): - Free: 792736 (Runtime.getRuntime().freeMemory())
05-23 15:09:26.386: DEBUG/Memory Usage(618): Native Heap
05-23 15:09:26.386: DEBUG/Memory Usage(618): - Allocated: 10139952 (Debug.getNativeHeapAllocatedSize())
05-23 15:09:26.396: DEBUG/Memory Usage(618): - Size: 10383360 (Debug.getNativeHeapSize())
05-23 15:09:26.396: DEBUG/Memory Usage(618): - Free: 136912 (Debug.getNativeHeapFreeSize())
Any suggestions and/or comments would be most welcome.
Thanks for reading,
Wayne.
Dont know if anyone has come across this issue but I am creating an app for mobile devices and it runs fine on my galaxy s2 running ics 4.0.4 however when I run it on the galaxy tab running 2.3.3 it keeps throwing errors.
All that I am doing is getting the device camera and attaching it to a flash.media.Video. I have the suspicion that the amount of errors caused by this issues is severly affecting the perfomance.
I have attached an fxp file ( https://www.box.com/s/77a9460edcf8a7ce95ee ) so that you can see that I am not doing anything out of the ordinary.
THanks for your help!
P.S.
Here is a sample segment of the logcat-
D/TvOut-Engine( 79): (isHdmiCableConnected): mHdmiCableConnected 0
D/CameraHardwareSec( 75): MemoryHeapBase(fd(26), size(5760128), width(800), height(600))
W/AudioFlinger( 75): RecordThread: buffer overflow
D/dalvikvm(12597): GC_FOR_MALLOC freed 1206K, 48% free 4217K/8007K, external 4034K/4493K, paused 91ms
V/AudioHardwareALSA( 75): resampler read error -32
D/AudioHardwareALSA( 75): AudioStreamInALSA::read error -32
D/AudioHardwareALSA( 75): AudioStreamInALSA::snd_pcm_recover error 0
E/v4l2_utils( 75): Error = Invalid argument from qbuf
E/CameraHardwareSec( 75): ERR(int android::CameraHardwareSec::previewThread()):overlay queueBuffer fail
I/dalvikvm-heap(12597): Grow heap (frag case) to 16.060MB for 5760016-byte allocation
D/dalvikvm(12597): GC_FOR_MALLOC freed 203K, 30% free 9638K/13639K, external 3975K/4493K, paused 26ms
E/v4l2_utils( 75): Error = Invalid argument from qbuf
E/CameraHardwareSec( 75): ERR(int android::CameraHardwareSec::previewThread()):overlay queueBuffer fail
D/dalvikvm(12597): GC_CONCURRENT freed 91K, 31% free 9547K/13639K, external 3975K/4493K, paused 2ms+13ms
D/dalvikvm(12597): GC_FOR_MALLOC freed 76K, 31% free 9471K/13639K, external 3975K/4493K, paused 43ms
E/v4l2_utils( 75): Error = Invalid argument from qbuf
E/CameraHardwareSec( 75): ERR(int android::CameraHardwareSec::previewThread()):overlay queueBuffer fail
I/dalvikvm-heap(12597): Grow heap (frag case) to 21.133MB for 5760016-byte allocation
E/v4l2_utils( 75): Error = Invalid argument from qbuf
E/CameraHardwareSec( 75): ERR(int android::CameraHardwareSec::previewThread()):overlay queueBuffer fail