wasabia / three_dart

three.js rewrite by Dart, Dart 3D library. an easy to use, lightweight, cross-platform, general purpose 3D library.
MIT License
450 stars 80 forks source link

THREE.Line出现OOM问题:sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory #152

Open wesker-chs opened 9 months ago

wesker-chs commented 9 months ago

发现绘制直线时,THREE.Line会出现OOM。 示例仅单条直线: 连接两点的直线,两点为随机数,每帧改变一次。首次为创建Line,其后为修改 lineGeometry.setAttribute( 'position',..)。

运行15秒左右,出现OOM。

有没有同学能解决,请求帮助!!!

if(isNew) {
      final lineGeometry = THREE.BufferGeometry();
      final lineMaterial = THREE.LineBasicMaterial();
      lineMaterial.color = THREE.Color(colorValue);
      lineGeometry.setAttribute( 'position', THREE.Float32BufferAttribute( Float32Array.from( [dx1, dy1, dz1, dx2, dy2, dz2] ), 3 ) );
      final object = THREE.Line( lineGeometry, lineMaterial );
      scene.add( object );
else {
      final lineGeometry = object.geometry as THREE.BufferGeometry;
      lineGeometry.setAttribute( 'position', THREE.Float32BufferAttribute( Float32Array.from( [dx1, dy1, dz1, dx2, dy2, dz2] ), 3 ) );
}

Error信息:

W/Adreno-GSL(20637): <sharedmem_gpuobj_alloc:2713>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
E/Adreno-GSL(20637): <gsl_memory_alloc_pure:2297>: GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed.
W/Adreno-GSL(20637): <sharedmem_gpuobj_alloc:2713>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
E/Adreno-GSL(20637): <gsl_memory_alloc_pure:2297>: GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed.
W/Adreno-GSL(20637): <sharedmem_gpuobj_alloc:2713>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
E/Adreno-GSL(20637): <gsl_memory_alloc_pure:2297>: GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed.
W/Adreno-GSL(20637): <sharedmem_gpuobj_alloc:2713>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
E/Adreno-GSL(20637): <gsl_memory_alloc_pure:2297>: GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed.
W/Adreno-GSL(20637): <sharedmem_gpuobj_alloc:2713>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
W/libc    (20637): calloc(1, 144) failed: returning null pointer
I/chatty  (20637): uid=10713(tech.xx.xxx) 1.ui identical 50 lines
W/libc    (20637): calloc(1, 144) failed: returning null pointer
W/libc    (20637): calloc(7692, 1) failed: returning null pointer
W/libc    (20637): malloc(136) failed: returning null pointer
F/libc    (20637): Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 20674 (1.ui), pid 20637 (ch.xx)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'Xiaomi/cepheus/cepheus:10/QKQ1.190825.002/V12.0.6.0.QFACNXM:user/release-keys'
Revision: '0'
ABI: 'arm64'
Timestamp: 2023-12-30 17:57:59+0800
pid: 20637, tid: 20674, name: 1.ui  >>> tech.xxx.xxx <<<
uid: 10713
signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
    x0  0000000000000000  x1  00000000000050c2  x2  0000000000000006  x3  000000728716bd90
    x4  fefeff727a514f97  x5  fefeff727a514f97  x6  fefeff727a514f97  x7  7f7f7f7f7f7f7fff
    x8  00000000000000f0  x9  c6f7e0fcdfcd18e6  x10 0000000000000001  x11 0000000000000000
    x12 fffffff0fffffbdf  x13 ffffffffffffffff  x14 0000000000000004  x15 ffffffffffffffff
    x16 000000737be27738  x17 000000737be05d20  x18 0000007286830000  x19 000000000000509d
    x20 00000000000050c2  x21 00000000ffffffff  x22 000000728716c428  x23 000000000000001b
    x24 0000007279629800  x25 000000728aab20c4  x26 0000000000000001  x27 0000000000000018
    x28 0000000000000034  x29 000000728716be30
    sp  000000728716bd70  lr  000000737bdb7404  pc  000000737bdb7430
backtrace:
      #00 pc 0000000000073430  /apex/com.android.runtime/lib64/bionic/libc.so (abort+160) (BuildId: 084c8a81b8c78e19cd9a1ff6208e77cf)
      #01 pc 000000000203a130  /data/app/tech.xx.xxx-zqmeo6pvqEvx79mSIrYaQA==/lib/arm64/libflutter.so!libflutter.so (offset 0x1b87000) (BuildId: af5f1c45192bcdb67b58b24542982cc184d4eb35)
      #02 pc 3057ad93658fe9a6  <unknown>