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:
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:
Martin
Martin le 21 Mai 2026 à 13:11 (modifié(e) le 21 Mai 2026 à 13:11)
Ubuntu 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.
Bert RAM Aerts
Bert RAM Aerts le 22 Mai 2026 à 7:41
Thanks for this workaround !
On my Ubuntu 26.04 XFCE X11 with Matlab R2026a update 2 I got the
free(): chunks in smallbin corrupted
But also matlab kept on running after typing exit in the command window.
This is my matlab.sh (without export):
#!/bin/bash
# 1. Update path for GCC 13
export PATH=/home/common/bin_gcc_13:$PATH
# 2. Safely construct LD_PRELOAD (avoiding leading/trailing colons if empty)
# https://nl.mathworks.com/matlabcentral/discussions/general/887876-matlab-crash-on-ubuntu-26-04-free-chunks-in-smallbin-corrupted
if [ -z "$LD_PRELOAD" ]; then
LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libtcmalloc_minimal.so.4"
else
LD_PRELOAD="${LD_PRELOAD}:/usr/lib/x86_64-linux-gnu/libtcmalloc_minimal.so.4"
fi
# 3. Launch MATLAB. Because we didn't use 'export' above, this variable
# will NOT bleed into the external terminal tools MATLAB tries to spawn.
exec matlab -desktop
Michal
Michal le 21 Mai 2026 à 14:03
From my point of view is using of tcmalloc instead of glibc malloc definitely not secure, reliable and generally recommended way how to solve this incompatibility problem. But, of course, if this hack works for you ... Good luck!
Michal
Michal le 18 Mai 2026 à 9:24 (modifié(e) le 18 Mai 2026 à 9:34)
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:
  1. Command Integration: It adds MATLAB to the Debian alternatives system, allowing you to run matlab from any terminal.
  2. Desktop Shortcuts: It creates a standard application launcher/icon for the desktop environment.
  3. 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.
Gonzalo
Gonzalo le 17 Mai 2026 à 17:28
The issue is even bigger, since addons CANNOT be installed, because MATLAB restarts itself, and it crashes in the process
Michal
Michal le 18 Mai 2026 à 8:54 (modifié(e) le 18 Mai 2026 à 9:02)
This is not issue or bug!!! This is logical and fully expected consequence of very new and so far unsupported OS (Ubuntu 26.04) incompatibility with R2026a.
Ubuntu 26.04 contains many deep and crucial changes on system level. So there is nearly impossible to overcome this "issue" by any simple hacks as you probably expect.
Kevin Tan
Kevin Tan le 21 Mai 2026 à 13:28
You're being strangely defensive. I'm not expecting a magic fix, I just wanted to give people a heads up with detailed documentation about this ("non-issue" as per your verbage) Matlab + Ubuntu 26.04 incompatibility. This issue is mainly cosmetic anyway, re-running some of my pipelines has given bit-perfect results relative to Ubuntu 24.04
Michal
Michal le 21 Mai 2026 à 14:42
As I said here a few minutes ago. If this hack (glibc_malloc -> tcmalloc) works for you... OK, you should be happy :) So my last "defensive" statement: This incompatibility issue is definitely not "mainly cosmetic"! For the vast majority of regular MATLAB users who are so impatient and start using Ubuntu 26.04 together with the latest, still INCOMPATIBLE versions of MATLAB, this problem is very difficult or almost catastrophic. The proposed solution (hack) is probably functional, but it is definitely not generally recommended.It is a pity that only a few people (mostly hack-oriented) participate in this discussion. It would be very interesting to know the opinion of more experienced users or MTW people on this topic.
Kevin Tan
Kevin Tan le 21 Mai 2026 à 15:30 (modifié(e) le 21 Mai 2026 à 15:36)
it's as if you expect me to tailor my entire workstation for Matlab. other software I'm using works best on Wayland, which Linux has been migrating to for the past 10+ years. I upgraded to Ubuntu 26.04 for native & enhanced Wayland support, along with native CUDA integration. none of my other IDEs (or any other software really) has had issues with upgrading to Ubuntu 26.04
matlab ships with an enormous, frozen userland instead of dynamically linking to system libraries like other IDEs. that's fine, but it will cause compatibility issues with Linux distros except for the narrow list of distros blessed by Matlab. I am simplty stating one of those incompatibilities for the benefit of other Linux users. my doing this seems to be making you aggrivated
Gonzalo
Gonzalo le 17 Mai 2026 à 19:05
In case anyone cames accross this issue, you can get a workaround working by launching the MATLAB installer again, choosing the install dir as the one were MATLAB is currently installed and select the desired products/addons from there
Kevin Tan
Kevin Tan le 18 Mai 2026 à 6:14 (modifié(e) le 18 Mai 2026 à 6:15)
I haven't been able to install addons on Matlab Linux without crazy workarounds for years now. It's worst when it's not an full-fledged Matlab toolbox but a community add-on or one of the small official Mathworks team add-ons.
The most impactful and mission-critical Matlab work is done on Linux (e.g. institutional HPC clusters) yet Matlab on Linux is so jank 😭☠ Yes Matlab on terminal or running batches works perfectly but the IDE is a hot mess, which is a shame because the Matlab IDE is unparalleled in many ways for scientific computing (if it actually works properly!)
Dennis
Dennis le 15 Mai 2026 à 15:22
--------------------------------------------------------------------------------
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
Kevin Tan
Kevin Tan le 15 Mai 2026 à 20:19
glad I'm not the only one! thanks for sharing the crash dump
Michal
Michal le 25 Avr 2026
Ubuntu 26.04 is not officially supported by R2026a (see https://www.mathworks.com/support/requirements/matlablinux.Html) Period...
Kevin Tan
Kevin Tan le 25 Avr 2026 (modifié(e) le 25 Avr 2026)
Ubuntu 25.10 isn't officially supported by R2026a yet it worked perfectly when running my signal processing, stats & ML pipelines, which are intensive and previously-validated on Ubuntu 24.04.
I know Ubuntu 26.04 isn't yet officially supported but I haven't had major issues running Matlab on unsupported Linux distros/versions (which many Matlab Linux users do) until now... Just wanted to let people know and see if people had ideas
This error is probably of interest to the Matlab team given that Ubuntu 26.04 is the current LTS release of the most popular Linux distro
Michal
Michal le 18 Mai 2026 à 8:43 (modifié(e) le 18 Mai 2026 à 9:07)
In this particular case, stop fighting!!! Ubuntu 26.04 differs from previous Ubuntu versions in so many fundamental ways that you definitely have to wait for R2026b, which will definitely be compatible with Ubuntu 26.04.Any "hacks" that would make R2026a work on Ubuntu 26.04 will just break your OS or MATLAB... probably both.
Kevin Tan
Kevin Tan le 21 Mai 2026 à 13:23
fighting?
Michal
Michal le 21 Mai 2026 à 13:32 (modifié(e) le 21 Mai 2026 à 13:37)
Yes, fighting with Matlab R2026a and Ubuntu 26.04 incompatibility :)You're just wasting your time.

Tags

Aucun tag saisi pour le moment.