android - Android应用程序中的OutOfMemoryError

标签 android android-widget out-of-memory

我之前曾就我的 Android 应用程序中的 OutOfMemoryError 问题寻求帮助。由于我还没有解决方案,所以我需要再次请你给我一个解决方案。我在几个真实的 android 设备上测试了我的应用程序。但是在 Samsung Galaxy S3 android 4.0.4 中我有 OutOfMemoryError 问题。 Logcat 消息如下。谢谢。

07-13 10:42:23.820: E/AndroidRuntime(2065): FATAL EXCEPTION: main
07-13 10:42:23.820: E/AndroidRuntime(2065): java.lang.OutOfMemoryError
07-13 10:42:23.820: E/AndroidRuntime(2065):     at android.graphics.Bitmap.nativeCreate(Native Method)
07-13 10:42:23.820: E/AndroidRuntime(2065):     at android.graphics.Bitmap.createBitmap(Bitmap.java:605)
07-13 10:42:23.820: E/AndroidRuntime(2065):     at android.graphics.Bitmap.createBitmap(Bitmap.java:551)
07-13 10:42:23.820: E/AndroidRuntime(2065):     at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:437)
07-13 10:42:23.820: E/AndroidRuntime(2065):     at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:618)
07-13 10:42:23.820: E/AndroidRuntime(2065):     at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:593)
07-13 10:42:23.820: E/AndroidRuntime(2065):     at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:445)
07-13 10:42:23.820: E/AndroidRuntime(2065):     at android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:468)
07-13 10:42:23.820: E/AndroidRuntime(2065):     at com.emin.avci.SeviyorSevmiyor.onCreate(SeviyorSevmiyor.java:75)
07-13 10:42:23.820: E/AndroidRuntime(2065):     at android.app.Activity.performCreate(Activity.java:4562)
07-13 10:42:23.820: E/AndroidRuntime(2065):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053)
07-13 10:42:23.820: E/AndroidRuntime(2065):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934)
07-13 10:42:23.820: E/AndroidRuntime(2065):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
07-13 10:42:23.820: E/AndroidRuntime(2065):     at android.app.ActivityThread.access$600(ActivityThread.java:128)
07-13 10:42:23.820: E/AndroidRuntime(2065):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
07-13 10:42:23.820: E/AndroidRuntime(2065):     at android.os.Handler.dispatchMessage(Handler.java:99)
07-13 10:42:23.820: E/AndroidRuntime(2065):     at android.os.Looper.loop(Looper.java:137)
07-13 10:42:23.820: E/AndroidRuntime(2065):     at android.app.ActivityThread.main(ActivityThread.java:4514)
07-13 10:42:23.820: E/AndroidRuntime(2065):     at java.lang.reflect.Method.invokeNative(Native Method)
07-13 10:42:23.820: E/AndroidRuntime(2065):     at java.lang.reflect.Method.invoke(Method.java:511)
07-13 10:42:23.820: E/AndroidRuntime(2065):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
07-13 10:42:23.820: E/AndroidRuntime(2065):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
07-13 10:42:23.820: E/AndroidRuntime(2065):     at dalvik.system.NativeStart.main(Native Method)

好的,这是我的应用崩溃的 Activity 的代码。

`公共(public)类 SeviyorSevmiyor 扩展 Activity 实现 OnTouchListener{

private int toastX=0,toastY=0;
private int fortuneCon;
private String toastMessage;
private String categoryName;

private ImageView activityHead;
private Vibrator shake;
private Toast toast;
private View layout;
private LayoutInflater inflater ;
private ViewGroup backgForToast;
private TextView textForToast ;

private Intent resultIntent;

private int[] leafIDs={R.id.bir,R.id.iki,R.id.uc,R.id.dort,R.id.bes,R.id.alti,R.id.yedi,
        R.id.sekiz,R.id.dokuz,R.id.on,R.id.onbir,R.id.oniki,R.id.onuc,R.id.ondort,R.id.onbes,R.id.onalti,R.id.iView1};
private int[] drwbles={R.drawable.leaf_1,R.drawable.leaf_2,R.drawable.leaf_3,R.drawable.leaf_4,R.drawable.leaf_5,R.drawable.leaf_6,
        R.drawable.leaf_7,R.drawable.leaf_8,R.drawable.leaf_9,R.drawable.leaf_10,R.drawable.leaf_11,R.drawable.leaf_12,R.drawable.leaf_13,R.drawable.leaf_14,
        R.drawable.leaf_15,R.drawable.leaf_16,R.drawable.papatya_orta};
ImageView[] leafs=new ImageView[17];
private Button leaf11_btn1,leaf11_btn2,leaf12_btn1,leaf12_btn2,leaf13_btn1,leaf13_btn2,leaf13_btn3,leaf14_btn1,leaf14_btn2,leaf15_btn1,
leaf15_btn2,leaf16_btn1,leaf1_btn1,leaf1_btn2,leaf2_btn1,leaf2_btn2,leaf3_btn1,leaf3_btn2,leaf4_btn1,leaf4_btn2,leaf5_btn1,leaf5_btn2
,leaf6_btn1,leaf6_btn2,leaf7_btn1,leaf7_btn2,leaf8_btn1,leaf8_btn2,leaf9_btn1,leaf9_btn2,leaf10_btn1,leaf10_btn2;

private Bitmap[] bmImages=new Bitmap[17];

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
        setContentView(R.layout.seviyor);

        activityHead=(ImageView) findViewById(R.id.activityhead1);
        shake = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
        BitmapFactory.Options options=new BitmapFactory.Options();


        for(int i=0;i<17;i++){
            if(bmImages[i]!=null){
                bmImages[i].recycle();
                bmImages=null;
            }
        }
        for(int i=0;i<17;i++){
            bmImages[i]=BitmapFactory.decodeResource(getResources(),drwbles[i] , options);
        }

        initilizeToastBackground();
        initilizeButtonsFor16Leafs();
        initilize16Lisener();

        resultIntent=new Intent(this,ResultFrame.class);
        fortuneCon=16;
        for(int i=0;i<17;i++){
            leafs[i]=(ImageView) findViewById(leafIDs[i]);
        }
        for(int i=0;i<17;i++){
            leafs[i].setImageBitmap(bmImages[i]);
        }


    Bundle frompreviousInent=getIntent().getExtras();
    categoryName=frompreviousInent.getString("category");
    setHeadOfActivity();
}


private void setHeadOfActivity() {
    if(categoryName.equalsIgnoreCase("seviyor")){
        activityHead.setImageResource(R.drawable.seviyor);
    }
    else if(categoryName.equalsIgnoreCase("konus")){
        activityHead.setImageResource(R.drawable.konus);
    }
    else if(categoryName.equalsIgnoreCase("ekle")){
        activityHead.setImageResource(R.drawable.ekle);
    }
    else{
        activityHead.setImageResource(R.drawable.teklif_et);
    }
}

private void initilize16Lisener() {
    leaf11_btn1.setOnTouchListener(this);
    leaf11_btn2.setOnTouchListener(this);
    leaf12_btn1.setOnTouchListener(this);
    leaf12_btn2.setOnTouchListener(this);
    leaf13_btn1.setOnTouchListener(this);
    leaf13_btn2.setOnTouchListener(this);
    leaf13_btn3.setOnTouchListener(this);
    leaf14_btn1.setOnTouchListener(this);
    leaf14_btn2.setOnTouchListener(this);
    leaf15_btn1.setOnTouchListener(this);
    leaf15_btn2.setOnTouchListener(this);
    leaf16_btn1.setOnTouchListener(this);
    leaf1_btn1.setOnTouchListener(this);
    leaf1_btn2.setOnTouchListener(this);
    leaf2_btn1.setOnTouchListener(this);
    leaf2_btn2.setOnTouchListener(this);
    leaf3_btn1.setOnTouchListener(this);
    leaf3_btn2.setOnTouchListener(this);
    leaf4_btn1.setOnTouchListener(this);
    leaf4_btn2.setOnTouchListener(this);
    leaf5_btn1.setOnTouchListener(this);
    leaf5_btn2.setOnTouchListener(this);
    leaf6_btn1.setOnTouchListener(this);
    leaf6_btn2.setOnTouchListener(this);
    leaf7_btn1.setOnTouchListener(this);
    leaf7_btn2.setOnTouchListener(this);
    leaf8_btn1.setOnTouchListener(this);
    leaf8_btn2.setOnTouchListener(this);
    leaf9_btn1.setOnTouchListener(this);
    leaf9_btn2.setOnTouchListener(this);
    leaf10_btn1.setOnTouchListener(this);
    leaf10_btn2.setOnTouchListener(this);
}

private void initilizeButtonsFor16Leafs() {
    leaf11_btn1 = (Button) findViewById(R.id.leaf11_bnt1);
    leaf11_btn2 = (Button) findViewById(R.id.leaf11_bnt2);

    leaf12_btn1 = (Button) findViewById(R.id.leaf12_bnt1);
    leaf12_btn2 = (Button) findViewById(R.id.leaf12_bnt2);

    leaf13_btn1 = (Button) findViewById(R.id.leaf13_bnt1);
    leaf13_btn2 = (Button) findViewById(R.id.leaf13_bnt2);
    leaf13_btn3 = (Button) findViewById(R.id.leaf13_bnt3);

    leaf14_btn1 = (Button) findViewById(R.id.leaf14_bnt1);
    leaf14_btn2 = (Button) findViewById(R.id.leaf14_bnt2);

    leaf15_btn1 = (Button) findViewById(R.id.leaf15_bnt1);
    leaf15_btn2 = (Button) findViewById(R.id.leaf15_bnt2);

    leaf16_btn1 = (Button) findViewById(R.id.leaf16_bnt1);

    leaf1_btn1 = (Button) findViewById(R.id.leaf1_btn1);
    leaf1_btn2 = (Button) findViewById(R.id.leaf1_btn2);

    leaf2_btn1 = (Button) findViewById(R.id.leaf2_bnt1);
    leaf2_btn2 = (Button) findViewById(R.id.leaf2_btn2);

    leaf3_btn1 = (Button) findViewById(R.id.leaf3_btn1);
    leaf3_btn2 = (Button) findViewById(R.id.leaf3_btn2);

    leaf4_btn1 = (Button) findViewById(R.id.leaf4_btn1);
    leaf4_btn2 = (Button) findViewById(R.id.leaf4_btn2);

    leaf5_btn1 = (Button) findViewById(R.id.leaf5_btn1);
    leaf5_btn2 = (Button) findViewById(R.id.leaf5_btn2);

    leaf6_btn1 = (Button) findViewById(R.id.leaf6_btn1);
    leaf6_btn2 = (Button) findViewById(R.id.leaf6_btn2);

    leaf7_btn1 = (Button) findViewById(R.id.leaf7_btn1);
    leaf7_btn2 = (Button) findViewById(R.id.leaf7_btn2);

    leaf8_btn1 = (Button) findViewById(R.id.leaf8_btn1);
    leaf8_btn2 = (Button) findViewById(R.id.leaf8_btn2);

    leaf9_btn1 = (Button) findViewById(R.id.leaf9_btn1);
    leaf9_btn2 = (Button) findViewById(R.id.leaf9_btn2);

    leaf10_btn1 = (Button) findViewById(R.id.leaf10_btn1);
    leaf10_btn2 = (Button) findViewById(R.id.leaf10_btn2);
}

public boolean onTouch(View v, MotionEvent event) {
    if(event.getAction() == MotionEvent.ACTION_DOWN){
        toast.cancel();
        this.toastX = (int) event.getRawX();
        this.toastY = (int) event.getRawY();
        switch (v.getId()) {
        case R.id.leaf11_bnt1 :
            showFortuneToast(toastX,toastY);
            shake.vibrate(40);
            clearBtnLeaf11();
            break;
        case R.id.leaf11_bnt2:
            showFortuneToast(toastX,toastY);
            shake.vibrate(40);
            clearBtnLeaf11();
            break;  
        case R.id.leaf12_bnt1:
            showFortuneToast(toastX,toastY);
            shake.vibrate(40);
            clearBtnLeaf12();
            break;
        case R.id.leaf12_bnt2:
            showFortuneToast(toastX,toastY);
            shake.vibrate(40);
            clearBtnLeaf12();
            break;
        case R.id.leaf13_bnt1:
            showFortuneToast(toastX,toastY);
            shake.vibrate(40);
            clearBtnLeaf13();
            break;  
        case R.id.leaf13_bnt2:
            showFortuneToast(toastX,toastY);
            shake.vibrate(40);
            clearBtnLeaf13();   
            break;
        case R.id.leaf13_bnt3:
            showFortuneToast(toastX,toastY);
            shake.vibrate(40);
            clearBtnLeaf13();
            break;
        case R.id.leaf14_bnt1:
            showFortuneToast(toastX,toastY);
            shake.vibrate(40);
            clearBtnLeaf14();
            break;
        case R.id.leaf14_bnt2:
            showFortuneToast(toastX,toastY);
            shake.vibrate(40);
            clearBtnLeaf14();   
            break;
        case R.id.leaf15_bnt1:
            showFortuneToast(toastX,toastY);
            shake.vibrate(40);
            clearBtnLeaf15();   
            break;
        case R.id.leaf15_bnt2:
            showFortuneToast(toastX,toastY);
            shake.vibrate(40);
            clearBtnLeaf15();
            break;
        case R.id.leaf16_bnt1:
            showFortuneToast(toastX,toastY);
            shake.vibrate(40);
            clearBtnLeaf16();   
            break;
        case R.id.leaf1_btn1:
            showFortuneToast(toastX,toastY);
            shake.vibrate(40);
            clearBtnLeaf1();
            break;
        case R.id.leaf1_btn2:
            showFortuneToast(toastX,toastY);
            shake.vibrate(40);
            clearBtnLeaf1();
            break;
        case R.id.leaf2_bnt1:
            showFortuneToast(toastX,toastY);
            shake.vibrate(40);
            clearBtnLeaf2();
            break;
        case R.id.leaf2_btn2:
            showFortuneToast(toastX,toastY);
            shake.vibrate(40);
            clearBtnLeaf2();
            break;
        case R.id.leaf3_btn1:
            showFortuneToast(toastX,toastY);
            shake.vibrate(40);
            clearBtnLeaf3();
            break;
        case R.id.leaf3_btn2:
            showFortuneToast(toastX,toastY);
            shake.vibrate(40);
            clearBtnLeaf3();
            break;
        case R.id.leaf4_btn1:
            showFortuneToast(toastX,toastY);
            shake.vibrate(40);
            clearBtnLeaf4();
            break;
        case R.id.leaf4_btn2:
            showFortuneToast(toastX,toastY);
            shake.vibrate(40);
            clearBtnLeaf4();
            break;
        case R.id.leaf5_btn1:
            showFortuneToast(toastX,toastY);
            shake.vibrate(40);
            clearBtnLeaf5();
            break;
        case R.id.leaf5_btn2:
            showFortuneToast(toastX,toastY);
            shake.vibrate(40);
            clearBtnLeaf5();
            break;
        case R.id.leaf6_btn1:
            showFortuneToast(toastX,toastY);
            shake.vibrate(40);
            clearBtnLeaf6();
            break;
        case R.id.leaf6_btn2:
            showFortuneToast(toastX,toastY);
            shake.vibrate(40);
            clearBtnLeaf6();
            break;
        case R.id.leaf7_btn1:
            showFortuneToast(toastX,toastY);
            shake.vibrate(40);
            clearBtnLeaf7();
            break;
        case R.id.leaf7_btn2:
            showFortuneToast(toastX,toastY);
            shake.vibrate(40);
            clearBtnLeaf7();
            break;
        case R.id.leaf8_btn1:
            showFortuneToast(toastX,toastY);
            shake.vibrate(40);
            clearBtnLeaf8();
            break;
        case R.id.leaf8_btn2:
            showFortuneToast(toastX,toastY);
            shake.vibrate(40);
            clearBtnLeaf8();
            break;
        case R.id.leaf9_btn1:
            showFortuneToast(toastX,toastY);
            shake.vibrate(40);
            clearBtnLeaf9();
            break;
        case R.id.leaf9_btn2:
            showFortuneToast(toastX,toastY);
            shake.vibrate(40);
            clearBtnLeaf9();
            break;
        case R.id.leaf10_btn1:
            showFortuneToast(toastX,toastY);
            shake.vibrate(40);
            clearBtnLeaf10();
            break;
        case R.id.leaf10_btn2:
            showFortuneToast(toastX,toastY);
            shake.vibrate(40);
            clearBtnLeaf10();
            break;
        default:
            break;
        }
    }
    return false;
}

private void showFortuneToast(int toastX2, int toastY2) {   

/**** 决定选择哪个类别(seviyor-sevmiyor、ekle-ekleme、konus-konuşma 等..)/ 如果(categoryName.equalsIgnoreCase(“seviyor”)){ 如果(fortuneCon%2==0){ toastMessage = "Seviyor"; } 别的{ toastMessage="Sevmiyor"; } } 否则如果(categoryName.equalsIgnoreCase(“konus”)){ 如果(fortuneCon%2==0){ toastMessage="科努斯"; } 别的{ toastMessage="Konuşma"; } } else if(categoryName.equalsIgnoreCase("ekle")){ 如果(fortuneCon%2==0){ toastMessage="Ekle"; } 别的{ toastMessage="Ekleme"; } } 否则如果(categoryName.equalsIgnoreCase(“teklifet”)){ 如果(fortuneCon%2==0){ toastMessage="Teklif Et"; } 别的{ toastMessage="Teklif Etme"; }

    textForToast.setText(toastMessage);
    toast.setGravity(Gravity.TOP|Gravity.LEFT, toastX2-90,toastY2-90);
    toast.setDuration(30);
    toast.setView(layout);
    toast.show();

    fortuneCon--;
    if(fortuneCon==0){
        toast.cancel();
        resultIntent.putExtra("result_cond", toastMessage);
        startActivity(resultIntent);
    }
}

private void initilizeToastBackground() {
    inflater = getLayoutInflater();
    backgForToast=(ViewGroup) findViewById(R.id.toast_layout_root);
    layout = inflater.inflate(R.layout.toastbackground,backgForToast);
    textForToast = (TextView) layout.findViewById(R.id.text);
    toast = new Toast(getApplicationContext());

}
private void clearBtnLeaf10() {
    leafs[9].setVisibility(View.GONE);
    leaf10_btn1.setVisibility(View.GONE);
    leaf10_btn2.setVisibility(View.GONE);
}
private void clearBtnLeaf9() {
    leafs[8].setVisibility(View.GONE);
    leaf9_btn1.setVisibility(View.GONE);
    leaf9_btn2.setVisibility(View.GONE);
}
private void clearBtnLeaf8() {
    leafs[7].setVisibility(View.GONE);
    leaf8_btn1.setVisibility(View.GONE);
    leaf8_btn2.setVisibility(View.GONE);
}
private void clearBtnLeaf7() {
    leafs[6].setVisibility(View.GONE);
    leaf7_btn1.setVisibility(View.GONE);
    leaf7_btn2.setVisibility(View.GONE);
}
private void clearBtnLeaf6() {
    leafs[5].setVisibility(View.GONE);
    leaf6_btn1.setVisibility(View.GONE);
    leaf6_btn2.setVisibility(View.GONE);
}
private void clearBtnLeaf5() {
    leafs[4].setVisibility(View.GONE);
    leaf5_btn1.setVisibility(View.GONE);
    leaf5_btn2.setVisibility(View.GONE);
}
private void clearBtnLeaf4() {
    leafs[3].setVisibility(View.GONE);
    leaf4_btn1.setVisibility(View.GONE);
    leaf4_btn2.setVisibility(View.GONE);
}
private void clearBtnLeaf3() {
    leafs[2].setVisibility(View.GONE);
    leaf3_btn1.setVisibility(View.GONE);
    leaf3_btn2.setVisibility(View.GONE);
}
private void clearBtnLeaf2() {
    leafs[1].setVisibility(View.GONE);
    leaf2_btn1.setVisibility(View.GONE);
    leaf2_btn2.setVisibility(View.GONE);
}
private void clearBtnLeaf1() {
    leafs[0].setVisibility(View.GONE);
    leaf1_btn1.setVisibility(View.GONE);
    leaf1_btn2.setVisibility(View.GONE);
}
private void clearBtnLeaf16() {
        leafs[15].setVisibility(View.GONE);
        leaf16_btn1.setVisibility(View.GONE);
}
private void clearBtnLeaf15() {
    leafs[14].setVisibility(View.GONE);
    leaf15_btn1.setVisibility(View.GONE);
    leaf15_btn2.setVisibility(View.GONE);
}
private void clearBtnLeaf14() {
    leafs[13].setVisibility(View.GONE);
    leaf14_btn1.setVisibility(View.GONE);
    leaf14_btn2.setVisibility(View.GONE);
}
private void clearBtnLeaf13() {
    leafs[12].setVisibility(View.GONE);
    leaf13_btn3.setVisibility(View.GONE);
    leaf13_btn1.setVisibility(View.GONE);
    leaf13_btn2.setVisibility(View.GONE);
}
private void clearBtnLeaf12() {
    leafs[11].setVisibility(View.GONE);
    leaf12_btn1.setVisibility(View.GONE);
    leaf12_btn2.setVisibility(View.GONE);
}
private void clearBtnLeaf11() {
    leafs[10].setVisibility(View.GONE);
    leaf11_btn1.setVisibility(View.GONE);
    leaf11_btn2.setVisibility(View.GONE);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
     if (keyCode == KeyEvent.KEYCODE_BACK) {
            Intent menuReturn=new Intent(this,MenuFrame.class);
            startActivity(menuReturn);
            }
    return super.onKeyDown(keyCode, event);
}

编辑:Android 版本 4.0.4 而不是 4.1 `

最佳答案

使用下面的方法来缩小图像的大小。由于图像尺寸过大,您收到 OutOfMemory 错误。

public static Bitmap decodeSampledBitmapFromResource(Resources res, int resId,
        int reqWidth, int reqHeight) {

    // First decode with inJustDecodeBounds=true to check dimensions
    final BitmapFactory.Options options = new BitmapFactory.Options();
    options.inJustDecodeBounds = true;
    BitmapFactory.decodeResource(res, resId, options);

    // Calculate inSampleSize
    options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight);

    // Decode bitmap with inSampleSize set
    options.inJustDecodeBounds = false;
    return BitmapFactory.decodeResource(res, resId, options);
}

public static int calculateInSampleSize(
            BitmapFactory.Options options, int reqWidth, int reqHeight) {
    // Raw height and width of image
    final int height = options.outHeight;
    final int width = options.outWidth;
    int inSampleSize = 1;

    if (height > reqHeight || width > reqWidth) {
        if (width > height) {
            inSampleSize = Math.round((float)height / (float)reqHeight);
        } else {
            inSampleSize = Math.round((float)width / (float)reqWidth);
        }
    }
    return inSampleSize;
}

并在您的代码中使用

mImageView.setImageBitmap(
    decodeSampledBitmapFromResource(getResources(), R.id.myimage, 100, 100));

更多详情,建议您必读developer Android 开发者网站提供的有关位图效率的信息。

关于android - Android应用程序中的OutOfMemoryError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11466300/

相关文章:

android - 在android应用程序的后台服务中强制关闭

android - 寻找任务完成的动画库以在 Android Studio 中使用

java - 如何将长日期值转换为 mm/dd/yyyy 格式

android - 为什么动态添加的小部件不显示?

Flutter 如何使用列表小部件进行内部 for 循环?

java - 另一个 Java OutOfMemoryError

android - 具有多个 TextView 和焦点的选框

android - 非常简单的代码,但是使用 Fragment 时出现错误 "Activity has been destroyed"

c# - 使用非托管资源

php - apache httpd 耗尽内存直到挂起