From 82fcd8122d8d6c37d64ea55899c56942a01f41b0 Mon Sep 17 00:00:00 2001 From: "maosheng.wei" Date: Wed, 6 Dec 2023 14:40:41 +0800 Subject: [PATCH] FIX: [5451]Directly crash when memory is low Jira: 5451 Change-Id: I5c75994e2bd556bec7ce8de6be44888e6924ff56 --- src/BambuStudio.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/BambuStudio.cpp b/src/BambuStudio.cpp index c5cf91c5e..2556fbf23 100644 --- a/src/BambuStudio.cpp +++ b/src/BambuStudio.cpp @@ -5520,15 +5520,8 @@ extern "C" { SET_DEFULTER_HANDLER(); #endif std::set_new_handler([]() { - int smallSize = 10 * 1024 * 1024; - int *test_apply = (int *) malloc(smallSize); - if (test_apply == NULL) { - throw std::bad_alloc(); - } else { - free(test_apply); - int *a = nullptr; - *a = 0; - } + int *a = nullptr; + *a = 0; }); // Call the UTF8 main. return CLI().run(argc, argv_ptrs.data());