Matlab crash on Ubuntu 26.04: "free(): chunks in smallbin corrupted"
I submitted a Matlab support case but posting this publicly to hopefully save people some trouble and see if anyone has ideas.
After upgrading my workstation from Ubuntu 25.10 to Ubuntu 26.04 LTS, MATLAB GUI consistently prints this terminal error on shutdown:
free(): chunks in smallbin corrupted
MATLAB appears to run normally, but closing the GUI takes a long time and sometimes produces crash dumps. The terminal error occurs every time I close the GUI, but crash dumps are intermittent. I attached one R2026a crash dump. I had zero issues on Ubuntu 25.10.
Affected versions:
- MATLAB R2026a
- MATLAB R2025b
- I suspect any 'new desktop' version
System:
- Ubuntu 26.04 LTS
- AMD EPYC 7443P
- NVIDIA RTX 3090
- Ubuntu 26.04 default NVIDIA driver: nvidia-driver-595-open, 595.58.03
- NVIDIA module path: /lib/modules/7.0.0-14-generic/kernel/nvidia-595-open/nvidia.ko
- glibc 2.43
Important note: the error first occurred with a clean MathWorks MATLAB installation before installing the Ubuntu/Debian `matlab-support` package. I later tested after installing `matlab-support`, which I understand modifies/renames some MATLAB-bundled libraries so MATLAB uses selected system libraries instead. The same shutdown error occurs both before and after applying `matlab-support`. This suggests the issue is not caused solely by the Debian/Ubuntu `matlab-support` integration or solely by one of the libraries it substitutes.
The attached crash dump shows abort/free() heap corruption detected in libc, but the higher-level stack includes MATLAB libraries such as:
- libmwcppmicroservices.so
- libmwmodule_descriptor_implementation.so
- libmwmatlab_main_lib.so
- libmwfoundation_threadpool.so
The issue appears GUI-specific. Using these startup flags shut down cleanly:
- matlab -batch
- matlab -nodesktop
- matlab -nodisplay
The shutdown error still occurs with these startup flags:
- normal GUI launch
- -nosplash
- -nojvm
- -softwareopengl
- -cefdisablegpu
The issue also persists after:
- renaming/resetting ~/.matlab/R2026a and ~/.MathWorks/R2026a
- launching with a clean environment without LD_LIBRARY_PATH, LD_PRELOAD, MATLAB_JAVA, JAVA_HOME, JRE_HOME, etc.
- testing a new Ubuntu user account
- testing Ubuntu/GNOME, GNOME, and Xfce X11 sessions
- testing NO_AT_BRIDGE=1 and GTK_USE_PORTAL=0
- temporarily moving ~/.MathWorks/ServiceHost
- testing GLIBC_TUNABLES=glibc.malloc.tcache_count=0
- trying to capture a system coredump with ulimit -c unlimited / coredumpctl; no system coredump was produced
Because R2025b and R2026a are both affected, terminal-only modes exit cleanly, the problem occurs across GNOME/Wayland and Xfce/X11, and the error occurred on a clean MATLAB install before any `matlab-support` modifications, this appears related to MATLAB GUI shutdown on Ubuntu 26.04 / glibc 2.43 rather than a corrupted MATLAB preference folder, a single desktop session, or the Ubuntu `matlab-support` package.
Example crash dump:
19 commentaires
Date décroissanteUbuntu 26.04 ships glibc 2.43, but R2025b only supports up to Ubuntu 24.04 (glibc 2.39). The crash occurs during session teardown in libmwsearch_path_impl.so - glibc 2.43's malloc detects corrupted smallbin metadata. Valgrind memcheck finds zero actual memory errors, so this appears to be a glibc 2.43 malloc-specific incompatibility rather than a bug in MATLAB's memory usage. MATLAB's ld_shim system also has no entry for Ubuntu 26.04.
Workaround: Replace glibc's malloc with tcmalloc via LD_PRELOAD. It uses a different heap layout that isn't affected.
sudo apt install libtcmalloc-minimal4t64
Then in your MATLAB wrapper script:
export LD_PRELOAD="${LD_PRELOAD}:/usr/lib/x86_64-linux-gnu/libtcmalloc_minimal.so.4"
Tested with R2025b Update 5 on Ubuntu 26.04 (glibc 2.43, kernel 7.0). Clean shutdown every time.
Has been working without issues so far, but I can't guarantee that swapping out the allocator doesn't break things elsewhere. Use at your own discretion.
And the final note regarding the "matlab-support" Linux DEB package, that you and many other Linux MATLAB users have mentioned in posts here.
Short version: Do not use it!!!
Long version:
The matlab-support package in Debian/Ubuntu is generally considered unreliable and potentially disruptive for modern, professional MATLAB setups. While it aims to simplify integration, its "hack-like" nature and intrusive system-level changes often outweigh its benefits for power users. Key Reliability Concerns
- Intrusive Library Substitution: The package often renames or moves MATLAB’s internal bundled libraries to force it to use system-wide libraries (like libstdc++). While intended to fix compatibility issues, this can cause unexpected crashes, such as heap corruption, that are difficult to debug because they affect MATLAB's core binaries.
- Difficult Reversion: Because it manually modifies files within your MATLAB installation directory, a standard apt remove may not restore your installation to its original "clean" state.
- Version Conflicts: It is poorly suited for systems with multiple MATLAB versions, as it may struggle to point to the correct installation or apply inconsistent changes across different releases.
- Documentation Gaps: Official documentation for its exact system impact is notably sparse, leading users to rely on community troubleshooting.
Primary Functions (What it actually does)
Despite the risks, the package is used for three main reasons:
- Command Integration: It adds MATLAB to the Debian alternatives system, allowing you to run matlab from any terminal.
- Desktop Shortcuts: It creates a standard application launcher/icon for the desktop environment.
- MEX Support: It provides helper utilities to help other Debian packages compile MEX extensions against your MATLAB installation.
Recommended Alternatives
To avoid the instability of matlab-support, most experienced users recommend:
- Manual Launcher Creation: Create your own .desktop file to get an icon without touching system libraries.
- Path Management: Add the MATLAB bin folder to your system PATH manually in your .bashrc or .zshrc file to enable the matlab command.
- MATLAB Package Manager (MPM): For modern installations (R2019a+), use the MATLAB Package Manager (MPM) to handle installations and updates more reliably through the command line.
If your installation is already corrupted, you may need to perform a clean re-installation by deleting the MATLAB folder and running the official installer again, as there is no guaranteed "undo" for all system-level changes made by this package.
The issue is even bigger, since addons CANNOT be installed, because MATLAB restarts itself, and it crashes in the process
--------------------------------------------------------------------------------
abort() detected at 2026-05-15 23:08:04 +0800
--------------------------------------------------------------------------------
Configuration:
Crash Decoding : Disabled - No sandbox or build area path
Crash Mode : continue (default)
Default Encoding : UTF-8
Deployed : false
Desktop Environment : ubuntu:GNOME
GNU C Library : 2.43 stable
Graphics Driver : Uninitialized hardware
Graphics card 1 : 0x10de ( 0x10de ) 0x28e0 Version 595.58.3.0 (0-0-0)
MATLAB Architecture : glnxa64
MATLAB Entitlement ID : 6265454
MATLAB Root : /opt/MATLAB/R2026a
MATLAB Version : 26.1.0.3234472 (R2026a) Update 1
OpenGL : hardware
Operating System : Ubuntu 26.04 LTS
Process ID : 31280
Processor ID : x86 Family 6 Model 183 Stepping 1, GenuineIntel
Session Key : 3z6nkm3uddytzjmjg5pgrwt3n
Window System : The X.Org Foundation (12401010), display :0
Fault Count: 1
Abnormal termination:
abort()
Current Thread: 'GTP_6' id 10822424196800
Register State (from fault):
RAX = 0000000000000000 RBX = 0000000000007bf4
RCX = 000009d86b8a648c RDX = 0000000000000006
RSP = 000009d7cabfe330 RBP = 000009d7cabfe370
RSI = 0000000000007bf4 RDI = 0000000000007a30
R8 = 0000000000000016 R9 = 0000000000000000
R10 = 0000000000000022 R11 = 0000000000000246
R12 = 0000000000000006 R13 = 000009d86a142000
R14 = 0000000000001000 R15 = 0000000000000000
RIP = 000009d86b8a648c EFL = 0000000000000246
CS = 0033 FS = 0000 GS = 0000
Stack Trace (from fault):
[ 0] 0x000009d86b8a648c /usr/lib/x86_64-linux-gnu/libc.so.6+00681100 pthread_kill+00000284
[ 1] 0x000009d86b845b7e /usr/lib/x86_64-linux-gnu/libc.so.6+00285566 gsignal+00000030
[ 2] 0x000009d86b8288ec /usr/lib/x86_64-linux-gnu/libc.so.6+00166124 abort+00000039
[ 3] 0x000009d86b829979 /usr/lib/x86_64-linux-gnu/libc.so.6+00170361
[ 4] 0x000009d86b8b0bac /usr/lib/x86_64-linux-gnu/libc.so.6+00723884
[ 5] 0x000009d86b8b25d4 /usr/lib/x86_64-linux-gnu/libc.so.6+00730580
[ 6] 0x000009d86b8b26b4 /usr/lib/x86_64-linux-gnu/libc.so.6+00730804
[ 7] 0x000009d86bb57066 /opt/MATLAB/R2026a/bin/glnxa64/libmwcppmicroservices.so+00335974 _ZNSt10_HashtableINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_N16cppmicroservices3AnyEESaISA_ENSt8__detail10_Select1stESt8equal_toIS5_ESt4hashIS5_ENSC_18_Mod_range_hashingENSC_20_Default_ranged_hashENSC_20_Prime_rehash_policyENSC_17_Hashtable_traitsILb1ELb0ELb1EEEE5clearEv+00000054
[ 8] 0x000009d842b22e75 /opt/MATLAB/R2026a/bin/glnxa64/libmwmodule_descriptor_implementation.so+00392821
[ 9] 0x000009d86bf01d1a /opt/MATLAB/R2026a/bin/glnxa64/libmwmatlab_main_lib.so+00171290 _ZNSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE10_M_releaseEv+00000090
[ 10] 0x000009d842b20383 /opt/MATLAB/R2026a/bin/glnxa64/libmwmodule_descriptor_implementation.so+00381827 _ZNSt17_Function_handlerIFvvEZN10foundation10concurrent10threadpool8Executor8postWorkIZN5agent3spf16cppmsclientutils6detail20ServiceTrackerEventsIN9MathWorks14MatlabPackages41IPackageDefinitionParsingServiceConnectorEE6invokeERSt11unique_lockISt5mutexESt8functionIFvSt10shared_ptrISD_ERKSt13unordered_mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEN16cppmicroservices3AnyESt4hashISS_ESt8equal_toISS_ESaISt4pairIKSS_SU_EEEEESL_S15_EUlvE_EENSt9enable_ifIXaaoo14is_invocable_vIT_E14is_invocable_vIS1A_NS3_10stop_tokenEEntoo9is_same_vINSt9remove_cvINSt16remove_referenceIS1A_E4typeEE4typeESJ_IS0_EE9is_same_vIS1H_SJ_IFvS1B_EEEENS3_6detail12ReturnHelperIXsrNS1L_13get_signatureIS1H_E4typeE5valueEE4typeEE4typeERKN7mwboost5uuids4uuidEOS1A_bEUlvE_E10_M_managerERSt9_Any_dataRKS22_St18_Manager_operation+00000051
[ 11] 0x000009d86ad186f9 /opt/MATLAB/R2026a/bin/glnxa64/libmwfoundation_threadpool.so+00186105
[ 12] 0x000009d86ad19094 /opt/MATLAB/R2026a/bin/glnxa64/libmwfoundation_threadpool.so+00188564
[ 13] 0x000009d86bcf5ef9 /usr/lib/x86_64-linux-gnu/libstdc++.so.6+01007353
[ 14] 0x000009d86b8a40da /usr/lib/x86_64-linux-gnu/libc.so.6+00671962
[ 15] 0x000009d86b9377ac /usr/lib/x86_64-linux-gnu/libc.so.6+01275820
Ubuntu 26.04 is not officially supported by R2026a (see https://www.mathworks.com/support/requirements/matlablinux.Html)
Period...
Connectez-vous pour participer