Hi. I'm writing an Augmented Reallity codes that should works in realtime,
But the VM's garbage collection hinders my program's performance. I checked my program's execution time for each in OnPrevFrame(byte[], Camera) and it execution time increases from around 50ms to 120ms at just after each garbage collection. I copied parts of logs below. (local time is just before and after of signal processing, and global time is time stamps for every onPreviewFrame() calling ) ----------------------------------------------------------------------------------------------------------------------------------------- 06-06 18:42:26.340: WARN/matchTarget(725): global 151844ms, local 167ms 06-06 18:42:26.390: WARN/matchTarget(725): global 55ms, local 54ms 06-06 18:42:26.510: DEBUG/dalvikvm(725): GC_FOR_MALLOC freed 20 objects / 346432 bytes in 88ms 06-06 18:42:26.510: WARN/matchTarget(725): global 119ms, local 115ms 06-06 18:42:26.600: WARN/matchTarget(725): global 83ms, local 75ms 06-06 18:42:26.670: WARN/matchTarget(725): global 76ms, local 70ms 06-06 18:42:26.740: WARN/matchTarget(725): global 66ms, local 63ms 06-06 18:42:26.820: DEBUG/dalvikvm(725): GC_FOR_MALLOC freed 73 objects / 464096 bytes in 55ms 06-06 18:42:26.830: WARN/matchTarget(725): global 95ms, local 94ms 06-06 18:42:26.890: WARN/matchTarget(725): global 57ms, local 56ms 06-06 18:42:26.940: WARN/matchTarget(725): global 46ms, local 45ms 06-06 18:42:27.000: WARN/matchTarget(725): global 59ms, local 59ms 06-06 18:42:27.070: DEBUG/dalvikvm(725): GC_FOR_MALLOC freed 144 objects / 466776 bytes in 56ms 06-06 18:42:27.080: WARN/matchTarget(725): global 80ms, local 79ms 06-06 18:42:27.150: WARN/matchTarget(725): global 71ms, local 65ms 06-06 18:42:27.210: WARN/matchTarget(725): global 61ms, local 60ms 06-06 18:42:27.250: WARN/matchTarget(725): global 41ms, local 39ms 06-06 18:42:27.310: WARN/matchTarget(725): global 57ms, local 41ms 06-06 18:42:27.350: DEBUG/dalvikvm(725): GC_FOR_MALLOC freed 207 objects / 584128 bytes in 39ms 06-06 18:42:27.420: WARN/matchTarget(725): global 116ms, local 59ms 06-06 18:42:27.470: WARN/matchTarget(725): global 50ms, local 49ms 06-06 18:42:27.530: WARN/matchTarget(725): global 58ms, local 55ms 06-06 18:42:27.620: DEBUG/dalvikvm(725): GC_FOR_MALLOC freed 210 objects / 353680 bytes in 58ms 06-06 18:42:27.630: WARN/matchTarget(725): global 96ms, local 95ms 06-06 18:42:27.690: WARN/matchTarget(725): global 61ms, local 57ms 06-06 18:42:27.740: WARN/matchTarget(725): global 57ms, local 55ms 06-06 18:42:27.820: WARN/matchTarget(725): global 76ms, local 68ms 06-06 18:42:27.870: WARN/matchTarget(725): global 49ms, local 46ms 06-06 18:42:27.900: DEBUG/dalvikvm(725): GC_FOR_MALLOC freed 226 objects / 469944 bytes in 34ms 06-06 18:42:27.970: WARN/matchTarget(725): global 97ms, local 55ms 06-06 18:42:28.000: WARN/matchTarget(725): global 39ms, local 38ms 06-06 18:42:28.080: WARN/matchTarget(725): global 80ms, local 61ms 06-06 18:42:28.170: DEBUG/dalvikvm(725): GC_FOR_MALLOC freed 220 objects / 469184 bytes in 50ms 06-06 18:42:28.170: WARN/matchTarget(725): global 86ms, local 84ms 06-06 18:42:28.230: WARN/matchTarget(725): global 60ms, local 52ms 06-06 18:42:28.280: WARN/matchTarget(725): global 52ms, local 51ms 06-06 18:42:28.340: WARN/matchTarget(725): global 61ms, local 59ms 06-06 18:42:28.420: DEBUG/dalvikvm(725): GC_FOR_MALLOC freed 193 objects / 468200 bytes in 53ms 06-06 18:42:28.430: WARN/matchTarget(725): global 82ms, local 81ms 06-06 18:42:28.490: WARN/matchTarget(725): global 64ms, local 57ms 06-06 18:42:28.550: WARN/matchTarget(725): global 61ms, local 60ms 06-06 18:42:28.610: WARN/matchTarget(725): global 57ms, local 56ms 06-06 18:42:28.690: DEBUG/dalvikvm(725): GC_FOR_MALLOC freed 205 objects / 468832 bytes in 58ms 06-06 18:42:28.700: WARN/matchTarget(725): global 88ms, local 86ms 06-06 18:42:28.750: WARN/matchTarget(725): global 58ms, local 55ms 06-06 18:42:28.810: WARN/matchTarget(725): global 54ms, local 53ms 06-06 18:42:28.860: WARN/matchTarget(725): global 52ms, local 51ms 06-06 18:42:28.990: DEBUG/dalvikvm(725): GC_FOR_MALLOC freed 226 objects / 469544 bytes in 42ms 06-06 18:42:28.990: WARN/matchTarget(725): global 134ms, local 100ms 06-06 18:42:29.060: WARN/matchTarget(725): global 62ms, local 52ms 06-06 18:42:29.100: WARN/matchTarget(725): global 49ms, local 47ms 06-06 18:42:29.160: WARN/matchTarget(725): global 51ms, local 50ms 06-06 18:42:29.240: DEBUG/dalvikvm(725): GC_FOR_MALLOC freed 197 objects / 468320 bytes in 52ms 06-06 18:42:29.240: WARN/matchTarget(725): global 84ms, local 83ms 06-06 18:42:29.290: WARN/matchTarget(725): global 51ms, local 43ms 06-06 18:42:29.350: WARN/matchTarget(725): global 53ms, local 39ms 06-06 18:42:29.410: WARN/matchTarget(725): global 69ms, local 44ms 06-06 18:42:29.470: WARN/matchTarget(725): global 54ms, local 44ms ----------------------------------------------------------------------------------------------------------------------------------------- Also I executed onPreviewFrame without any signal processing on it, but the garbage collection is also carried showing debegging message around 60ms it spends for memory release. Is this garbage collection come from releasing byte[] yuvs image data? ( i uses 320x240 thumb nail ) then... this clealy comes from Java's limitation, so there will be no hope for improvement unless I found a way to directly access camera device? do you think this is feasible? Hope listen to others' comments. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

