Closed nuoyan2 closed 4 years ago
random access memory 8G Flash1 6G cpu8核 1.4G
This just sound like your device is short on memory, possibly not only due to your own app. Have you tried to inspect available free memory and memory use of other apps when this happens?
这听起来好像您的设备内存不足,可能不仅是由于您自己的应用程序所致。您是否尝试过检查可用内存和其他应用程序的内存使用情况?
Thank you very much. Is that what you said C:\Users\Administrator>adb shell df -h Filesystem Size Used Avail Use% Mounted on rootfs 989M 3.0M 986M 1% / tmpfs 998M 448K 998M 1% /dev tmpfs 998M 0 998M 0% /mnt /dev/block/mmcblk1p10 1.9G 711M 1.2G 36% /system /dev/block/mmcblk1p13 45M 32M 13M 72% /vendor /dev/block/mmcblk1p9 122M 256K 122M 1% /cache /dev/block/mmcblk1p11 12M 44K 12M 1% /metadata /dev/block/mmcblk1p14 4.4G 376M 4.1G 9% /data tmpfs 998M 0 998M 0% /storage /data/media 4.4G 376M 4.1G 9% /mnt/runtime/default/emulated /data/media 4.4G 376M 4.1G 9% /storage/emulated /data/media 4.4G 376M 4.1G 9% /mnt/runtime/read/emulated /data/media 4.4G 376M 4.1G 9% /mnt/runtime/write/emulated
No. That checks for storage. Use free
, top
, etc. Maybe search Stack Overflow or alike for inspiration.
Thank you very much for your help. Is this the right one
This just sound like your device is short on memory, possibly not only due to your own app. Have you tried to inspect available free memory and memory use of other apps when this happens?
C:\Users\Administrator>adb shell free -m total used free shared buffers Mem: 1997 1083 913 53 1 -/+ buffers/cache: 1082 915 Swap: 508 0 508
I modified the build.prop file Increased memory will still report this error Below is my build.prop file
ro.build.id=NHG47K ro.build.display.id=rk3288-userdebug 7.1.2 NHG47K eng.hgt.20200521.202853 test-keys ro.build.version.incremental=eng.hgt.20200521.202853 ro.build.version.sdk=25 ro.build.version.preview_sdk=0 ro.build.version.codename=REL ro.build.version.all_codenames=REL ro.build.version.release=7.1.2 ro.build.version.security_patch=2017-04-05 ro.build.version.base_os= ro.build.date=Thu May 21 20:28:53 CST 2020 ro.build.date.utc=1590064133 ro.build.type=userdebug ro.build.user=hgt ro.build.host=hgt-Mini ro.build.tags=test-keys ro.build.flavor=rk3288-userdebug ro.product.model=rk3288 ro.product.brand=Android ro.product.name=rk3288 ro.product.device=rk3288 ro.product.board=rk30sdk
ro.product.cpu.abi=armeabi-v7a ro.product.cpu.abi2=armeabi ro.product.cpu.abilist=armeabi-v7a,armeabi ro.product.cpu.abilist32=armeabi-v7a,armeabi ro.product.cpu.abilist64= ro.product.manufacturer=rockchip ro.product.locale=zh-CN ro.wifi.channels= ro.board.platform=rk3288
ro.build.product=rk3288
ro.build.description=rk3288-userdebug 7.1.2 NHG47K eng.hgt.20200521.202853 test-keys ro.build.fingerprint=Android/rk3288/rk3288:7.1.2/NHG47K/hgt05212028:userdebug/test-keys ro.build.characteristics=tablet
#
# #
#
rild.libpath=/system/lib/libreference-ril.so rild.libargs=-d /dev/ttyUSB0
ro.ril.ecclist=112,911 ro.opengles.version=196610 wifi.interface=wlan0
persist.tegra.nvmmlite = 1 ro.audio.monitorOrientation=true
debug.nfc.fw_download=false debug.nfc.se=false
ro.rk.screenoff_time=2147483647 ro.rk.screenshot_enable=false ro.rk.def_brightness=200 ro.rk.homepage_base=http://www.google.com/webhp?client={CID}&source=android-home ro.rk.install_non_market_apps=false sys.hwc.compose_policy=6 sys.wallpaper.rgb565=0 sf.power.control=2073600 sys.rkadb.root=0 ro.sf.fakerotation=false ro.sf.hwrotation=270 ro.rk.MassStorage=false ro.rk.systembar.voiceicon=true ro.rk.systembar.tabletUI=false ro.rk.LowBatteryBrightness=false ro.tether.denied=false sys.resolution.changed=false ro.default.size=100 persist.sys.timezone=Asia/Shanghai ro.product.usbfactory=rockchip_usb wifi.supplicant_scan_interval=15 ro.factory.tool=0 ro.kernel.android.checkjni=0
ro.sf.lcd_density=160
sys.hwc.device.primary=DSI sys.hwc.device.extend=LVDS ro.adb.secure=0 ro.rk.displayd.enable=false
#
# ro.target.product=tablet dalvik.vm.heapstartsize=256m dalvik.vm.heapgrowthlimit=700m dalvik.vm.heapsize=512m dalvik.vm.heaptargetutilization=0.75 dalvik.vm.heapminfree=512k dalvik.vm.heapmaxfree=8m ro.config.ringtone=Ring_Synth_04.ogg ro.config.notification_sound=pixiedust.ogg ro.carrier=unknown ro.config.alarm_alert=Alarm_Classic.ogg ro.rksdk.version=RK30_ANDROID7.1.2-SDK-v1.00.00 camera2.portability.force_api=1 persist.sys.strictmode.visual=false ro.rk.bt_enable=true ro.rk.flash_enable=true ro.rk.hdmi_enable=true ro.factory.hasUMS=false persist.sys.usb.config=mtp,adb testing.mediascanner.skiplist=/mnt/shell/emulated/Android/ ro.factory.hasGPS=false ro.factory.storage_suppntfs=true ro.factory.without_battery=true ro.rk.screenoff_time=60000 ro.com.widevine.cachesize=16777216 ro.enable.optee=true ro.product.first_api_level=23 ro.boot.noril=false keyguard.no_require_sim=true ro.com.android.dataroaming=true ril.function.dataonly=1 ro.config.enable.remotecontrol=false ro.udisk.visible=true ro.safemode.disabled=true rild.libpath=/system/lib/libreference-ril.so ro.hwui.texture_cache_size=72 ro.hwui.layer_cache_size=48 ro.hwui.r_buffer_cache_size=8 ro.hwui.path_cache_size=32 ro.hwui.gradient_cache_size=1 ro.hwui.drop_shadow_cache_size=6 ro.hwui.texture_cache_flushrate=0.4 ro.hwui.text_small_cache_width=1024 ro.hwui.text_small_cache_height=1024 ro.hwui.text_large_cache_width=2048 ro.hwui.text_large_cache_height=1024 ro.hwui.disable_scissor_opt=true ro.rk.screenshot_enable=true sys.status.hidebar_enable=false persist.sys.ui.hw=true ro.product.version=1.0.0 ro.product.ota.host=www.rockchip.com:2300 ro.sys.sdcardfs=true persist.sys.dalvik.vm.lib.2=libart.so dalvik.vm.isa.arm.variant=cortex-a15 dalvik.vm.isa.arm.features=default dalvik.vm.lockprof.threshold=500 net.bt.name=Android dalvik.vm.stack-trace-file=/data/anr/traces.txt
ro.fota.platform=RK3288_7.1 ro.fota.type=pad ro.fota.app=5 ro.fota.id=sn ro.fota.oem=szhuayizn3288_7.1 ro.fota.device=rk3288 ro.fota.version=rk3288-userdebug 7.1.2 NHG47K eng.hgt.20200521.202853 test-keys_20200521-2029
ro.expect.recovery_id=0xd5a8be49cd07e438ca54d512c6a40ee5f09347ee000000000000000000000000
If I need any information, I will provide it in time. Thank you very much
The way I use it
RealmConfiguration config = new RealmConfiguration.Builder() .name("myrealm.realm") //文件名 .schemaVersion(0) //版本号 .build(); Realm realm = Realm.getInstance(config)
add methods:
/**
* add (增)
*/
public void addDog(final CommodityTypeRecordInfo dog) {
mRealm.beginTransaction();
mRealm.copyToRealm(dog);
mRealm.commitTransaction();
}
I use the for loop to increase the number of items to 6000 or more and Out of Memory Size occurs Thank you very much
@cmelchior Can you give me some ideas? Thank you
Have you tried reading https://realm.io/docs/java/latest/#faq-out-of-memory-exceptions
Have you tried reading https://realm.io/docs/java/latest/#faq-out-of-memory-exceptions
Thank you very much. I'll check it out right away
Have you tried reading https://realm.io/docs/java/latest/#faq-out-of-memory-exceptions Thank you very much for your help I have read the document just now, but I feel it is not the same as my requirement. As seen in the log, Out of Memory size: 31457280 Only 20M+ storage was used. I need to store 20,000 pieces of data I was wondering if increasing the storage size could solve my problem after all, I had no problem saving 5000 pieces before
@cmelchior
Running out of memory at only 31 MB is a bit surprising. It does indicate that your device is using a lot of memory for something else or is very memory-constrained. Unfortunately, there isn't much we can do about that from our end as that depends on exactly what the device is doing at the given time. Like maybe reading a lot of images that are not getting released?
The best you can do from the Realm side is to try to decrease the amount of data you are writing at a time since we need to keep everything in memory until it is persisted on disk. So I would start by breaking the 20.000 objects write into smaller transactions and see if that fixes the problem.
Thank you for sharing. I have a question to ask Here is the log io.realm.exceptions.RealmError: Unrecoverable error. mmap() failed: Out of memory size: 31457280 offset: 67108864 in /tmp/realm-java/realm/realm-library/src/main/cpp/io_realm_internal_OsSharedRealm.cpp line 143 at io.realm.internal.OsSharedRealm.nativeCommitTransaction(Native Method) at io.realm.internal.OsSharedRealm.commitTransaction(OsSharedRealm.java:283) at io.realm.BaseRealm.commitTransaction(BaseRealm.java:441) at io.realm.Realm.commitTransaction(Realm.java:145) at com.rfidstar.cashregister.activity.main.util.TfMemberHelper.addDog(TfMemberHelper.java:45) at com.rfidstar.cashregister.activity.main.MainUtils.processData(MainUtils.java:197) at com.rfidstar.cashregister.activity.main.MainUtils.access$000(MainUtils.java:49) at com.rfidstar.cashregister.activity.main.MainUtils$2.onResponse(MainUtils.java:173) at com.rfidstar.cashregister.activity.main.MainUtils$2.onResponse(MainUtils.java:163) at com.zhy.http.okhttp.OkHttpUtils$3.run(OkHttpUtils.java:186) at android.os.Handler.handleCallback(Handler.java:755) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6141) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:802)
I have seen several similar problems, but they all prompted this problem only when the memory reached 480m-2G. I did not know why this problem appeared when the memory reached 20M I am using 'Plugin :6.0.1' and I would like to know if there is a way to enlarge the memory About 200M is enough for me My device is 5 gigabytes of memory