Repository navigation
Description
Steps to reproduce
Run the attached code sample on a GNU/Linux machine.
Expected results
The application launches without any issues.
Actual results
The application crashes with following logging as soon as it hits the HTTP request:
../../../flutter/third_party/libcxx/src/new.cpp:63: assertion !std::__is_function_overridden(static_cast<void* (*)(std::size_t)>(&operator new)) failed: libc++ was configured with exceptions disabled and `operator new(size_t)` has been overridden, but `operator new(size_t, nothrow_t)` has not been overridden. This is problematic because `operator new(size_t, nothrow_t)` must call `operator new(size_t)`, which will terminate in case it fails to allocate, making it impossible for `operator new(size_t, nothrow_t)` to fulfill its contract (since it should return nullptr upon failure). Please make sure you override `operator new(size_t, nothrow_t)` as well.
Code sample
Additional details
The media_kit package suffers from some severe memory leaks on GNU/Linux (I assume some memory allocation conflict/combination between Flutter, GTK/glibc, mpv etc.). Almost 3-4 years later, the cause is still unknown.
However, we discovered that shipping the app with mimalloc (an alternative memory allocator) surprisingly fixes all of the memory leaks entirely.
The code sample provided above provides a simple app which statically links the app executable to mimalloc, which now results in a crash. You may comment/uncomment this line to disable/enable mimalloc. There is no crash till Flutter version 3.41.9. The first Flutter version which crashes is Flutter 3.44.0.
One another way to use mimalloc is LD_PRELOAD. Previously, this method also fixed the memory leaks. But now, the memory usage keeps growing (though the app does not crash unlike static linking), even after loading mimalloc with LD_PRELOAD.
MIMALLOC_VERBOSE=1 LD_PRELOAD=$(ldconfig -p | awk '/libmimalloc\.so/ {print $NF; exit}') ./build/linux/x64/debug/bundle/test
I am now stuck in a situation where I can no longer upgrade my Flutter version.
Thanks a lot for your attention here.
Screenshots or Video
N/A
Logs
Logs
Launching lib/main.dart on Linux in debug mode...
Building Linux application...
✓ Built build/linux/x64/debug/bundle/test
Gdk-Message: 00:00:58.244: Unable to load from the cursor theme
Syncing files to device Linux... 121ms
Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).
A Dart VM Service on Linux is available at: http://127.0.0.1:37395/sWJN0iwjL-8=/
The Flutter DevTools debugger and profiler on Linux is available at: http://127.0.0.1:37395/sWJN0iwjL-8=/devtools/?uri=ws://127.0.0.1:37395/sWJN0iwjL-8=/ws
../../../flutter/third_party/libcxx/src/new.cpp:63: assertion !std::__is_function_overridden(static_cast<void* (*)(std::size_t)>(&operator new)) failed: libc++ was configured with exceptions disabled and `operator new(size_t)` has been overridden, but `operator new(size_t, nothrow_t)` has not been overridden. This is problematic because `operator new(size_t, nothrow_t)` must call `operator new(size_t)`, which will terminate in case it fails to allocate, making it impossible for `operator new(size_t, nothrow_t)` to fulfill its contract (since it should return nullptr upon failure). Please make sure you override `operator new(size_t, nothrow_t)` as well.
Lost connection to device.Flutter Doctor output
Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.44.4, on Fedora Linux 43 (Workstation Edition) 6.17.1-300.fc43.x86_64, locale en_US.UTF-8)
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/to/linux-android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, please use
`flutter config --android-sdk` to update to that location.
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Connected device (2 available)
[✓] Network resources
! Doctor found issues in 1 category.
Activity
mbcorona commentedon Jul 2, 2026
HI @alexmercerind , thanks for the report. Routing to the Linux team for further investigation.
[-][GNU/Linux][Bug Report / Question] Unable to use mimalloc after Flutter 3.35.7[/-][+][GNU/Linux][Bug Report / Question] Unable to use mimalloc after (excluding) Flutter 3.41.9[/+]alexmercerind commentedon Jul 2, 2026
Hi!
I have been manually compiling & testing the provided code sample against multiple Flutter versions of the past. It seems there is no crash till Flutter version 3.41.9. The first Flutter version which crashes is Flutter 3.44.0. So, the offending change is somewhat recent, and exists between the releases 3.41.9 to 3.44.0.
I have updated the issue title/comment to reflect the discovery. I apologize for initial confusion.
Thanks!
chore: downgrade flutter to 3.41.8