でアプリがクラッシュします。アプリケーションは致命的なシグナル11で突然クラッシュします。ログには「D/RenderScript:Missing .rs.global_entries from shared object」というメッセージが100個あります。メモリの大幅な増加も見てください。 これはどのような原因ですか?どのようにそれを解決するのですか?のrenderScriptは、私は一連の画像を回転させるためのrenderScriptを使用しています「ミッシング.rs.global_entries」
私は、Android 4.4.2でサムスンGalexy]タブを使用しています。私は以下のGradle、Rs、Java、logcat出力をリストアップしました。
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
minSdkVersion 18
targetSdkVersion 21
renderscriptTargetApi 18
renderscriptSupportModeEnabled true
#pragma version(1)
#pragma rs_fp_relaxed
#pragma rs java_package_name(com.models)
rs_allocation inImage;
int inWidth;
int inHeight;
uchar4 __attribute__ ((kernel)) rotate_270_clockwise (uchar4 in, uint32_t x, uint32_t y) {
uint32_t inX = inWidth - 1 - y;
uint32_t inY = x;
const uchar4 *out = rsGetElementAt(inImage, inX, inY);
return *out;
}
uchar4 __attribute__ ((kernel)) rotate_180_clockwise (uchar4 in, uint32_t x, uint32_t y) {
uint32_t inX = inWidth - 1 - x;
uint32_t inY = inHeight - 1 - y;
const uchar4 *out = rsGetElementAt(inImage, inX, inY);
return *out;
}
uchar4 __attribute__ ((kernel)) rotate_90_clockwise (uchar4 in, uint32_t x, uint32_t y) {
uint32_t inX = y;
uint32_t inY = inHeight - 1 - x;
const uchar4 *out = rsGetElementAt(inImage, inX, inY);
return *out;
}
uchar4 __attribute__ ((kernel)) rotate_0_clockwise (uchar4 in, uint32_t x, uint32_t y) {
uint32_t inX = x;
uint32_t inY = y;
const uchar4 *out = rsGetElementAt(inImage, inX, inY);
return *out;
}
Javaコード
public Bitmap rotateBitmap(Bitmap bitmap, Activity activity, int angle, boolean recycle) {
Bitmap target = null;
try {
RenderScript rs = RenderScript.create(activity, RenderScript.ContextType.DEBUG);
ScriptC_rotator script = new ScriptC_rotator(rs);
script.set_inWidth(bitmap.getWidth());
script.set_inHeight(bitmap.getHeight());
Allocation sourceAllocation = Allocation.createFromBitmap(rs, bitmap,
Allocation.MipmapControl.MIPMAP_NONE,
Allocation.USAGE_SCRIPT);
if (recycle)
bitmap.recycle();
script.set_inImage(sourceAllocation);
//270 and 90
int targetHeight = bitmap.getWidth();
int targetWidth = bitmap.getHeight();
if (angle == 180 || angle == 0) {
targetHeight = bitmap.getHeight();
targetWidth = bitmap.getWidth();
}
Bitmap.Config config = bitmap.getConfig();
target = Bitmap.createBitmap(targetWidth, targetHeight, config);
final Allocation targetAllocation = Allocation.createFromBitmap(rs, target,
Allocation.MipmapControl.MIPMAP_NONE,
Allocation.USAGE_SCRIPT);
if (angle == 90)
script.forEach_rotate_90_clockwise(targetAllocation, targetAllocation);
else if (angle == 180)
script.forEach_rotate_180_clockwise(targetAllocation, targetAllocation);
else if (angle == 270)
script.forEach_rotate_270_clockwise(targetAllocation, targetAllocation);
else
script.forEach_rotate_0_clockwise(targetAllocation, targetAllocation);
targetAllocation.copyTo(target);
rs.destroy();
} catch (Exception e) {
Log.d("myApp", "rotateBitmap- render script " + e.getMessage());
}
return target;
}
ログイン
04-19 22:04:02.219 30377-30377/com.champ D/myApp﹕ processActionUp-scaleDetector.isInProgress()
04-19 22:04:04.259 30377-30761/com.champ D/RenderScript﹕ Missing .rs.global_entries from shared object
04-19 22:04:04.259 30377-30761/com.champ D/RenderScript﹕ Missing .rs.global_entries from shared object
04-19 22:04:04.269 30377-30761/com.champ D/RenderScript﹕ Missing .rs.global_entries from shared object
04-19 22:04:04.269 30377-30761/com.champ D/RenderScript﹕ Missing .rs.global_entries from shared object
04-19 22:04:04.279 30377-30761/com.champ D/RenderScript﹕ Missing .rs.global_entries from shared object
04-19 22:04:04.279 30377-30761/com.champ D/RenderScript﹕ Missing .rs.global_entries from shared object
04-19 22:04:04.289 30377-30761/com.champ D/RenderScript﹕ Missing .rs.global_entries from shared object
04-19 22:04:04.319 30377-30377/com.champ D/myApp﹕ processActionUp
04-19 22:04:04.319 30377-30377/com.champ D/myApp﹕ processActionUp-scaleDetector.isInProgress()
04-19 22:04:07.389 30377-30377/com.champ D/dalvikvm﹕ GC_FOR_ALLOC freed 2335K, 9% free 33300K/36444K, paused 26ms, total 26ms
04-19 22:04:07.389 30377-30377/com.champ I/dalvikvm-heap﹕ Grow heap (frag case) to 33.607MB for 320336-byte allocation
04-19 22:04:07.409 30377-30377/com.champ D/dalvikvm﹕ GC_FOR_ALLOC freed 3K, 9% free 33609K/36760K, paused 20ms, total 20ms
04-19 22:04:07.419 30377-30761/com.champ D/RenderScript﹕ Missing .rs.global_entries from shared object
04-19 22:04:07.479 30377-30761/com.champ D/RenderScript﹕ Missing .rs.global_entries from shared object
04-19 22:04:07.489 30377-30761/com.champ D/RenderScript﹕ Missing .rs.global_entries from shared object
04-19 22:04:07.489 30377-30761/com.champ D/RenderScript﹕ Missing .rs.global_entries from shared object
04-19 22:04:07.499 30377-30761/com.champ D/RenderScript﹕ Missing .rs.global_entries from shared object
04-19 22:04:07.509 30377-30761/com.champ D/RenderScript﹕ Missing .rs.global_entries from shared object
04-19 22:04:07.509 30377-30761/com.champ D/RenderScript﹕ Missing .rs.global_entries from shared object
04-19 22:04:07.519 30377-30761/com.champ D/RenderScript﹕ Missing .rs.global_entries from shared object
04-19 22:04:07.529 30377-30761/com.champ D/RenderScript﹕ Missing .rs.global_entries from shared object
04-19 22:04:07.529 30377-30761/com.champ D/RenderScript﹕ Missing .rs.global_entries from shared object
04-19 22:04:07.559 30377-30377/com.champ D/myApp﹕ processActionUp
04-19 22:04:07.559 30377-30377/com.champ D/myApp﹕ processActionUp-scaleDetector.isInProgress()
04-19 22:04:11.709 30377-30377/com.champ D/dalvikvm﹕ GC_FOR_ALLOC freed 1496K, 12% free 32489K/36760K, paused 20ms, total 20ms
04-19 22:04:11.759 30377-30377/com.champ D/dalvikvm﹕ GC_FOR_ALLOC freed 20K, 11% free 32843K/36760K, paused 18ms, total 19ms
04-19 22:04:11.759 30377-30377/com.champ I/dalvikvm-heap﹕ Grow heap (frag case) to 33.221MB for 383696-byte allocation
04-19 22:04:11.779 30377-30386/com.champ D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 11% free 33217K/37136K, paused 16ms, total 17ms
04-19 22:04:11.779 30377-30761/com.champ D/RenderScript﹕ Missing .rs.global_entries from shared object
04-19 22:04:11.789 30377-30763/com.champ A/libc﹕ Fatal signal 11 (SIGSEGV) at 0x66082000 (code=1), thread 30763 (AsyncTask #4)
あなたの答えをありがとう。あなたのご意見は、パフォーマンスを大幅に向上させるのに役立ちました。クラッシュは幅と高さのためです。私もそれを解決しました。ありがとう – pats