Fix MATLAB Error: “dlopen: cannot load any more object with static TLS”

On Linux, you may occasionally encounter the error “dlopen: cannot load any more object with static TLS” in MATLAB. This is a known bug since way back!

To fix, create a file “startup.m” in the directory that you start MATLAB from with the following content:

ones(10)*ones(10);

I know! It’s ugly… But it works!!

EDIT: Since it was not clear, the folder that you start MATLAB from is by default “~/Documents/MATLAB” under Linux. On Windows, that would be “Documents\MATLAB”.

9 comments

Skip to comment form

    • Stuart on February 23, 2015 at 1:48 PM
    • Reply

    I did this and restarted MATLAB and the problem went away. I don’t know whether it was this fix or restarting MATLAB that did it, but thanks one way or another. By the way, I think this solution is very elegant, not ugly in the least.

    1. Restarting MATLAB sometimes solves the problem. I’ve never encountered the issue again after doing this fix. Glad it worked for you as well.

    • Hadi on April 15, 2015 at 6:20 PM
    • Reply

    Yeah restarting the Matlab did the job :))

    1. Without the fix, it will come back at some point. Trust me, I’ve been there 😉

    • Sophia on November 18, 2015 at 5:42 AM
    • Reply

    Using MATLAB2014a. This does not solve the problem. Neither does repeatedly restarting MATLAB. Any other ideas?

    1. I tried this on MATLAB 2014a as well. Can you verify that your “startup.m” file is actually working? To test, modify it so that it would store the matrix in a variable (eg. A = ones(10)*ones(10);) and then check to see if A is defined when MATLAB has started.
      When I was facing this issue, I looked around a lot and couldn’t find any other fix that worked for an extended period of time other than this.

        • yuxiao on July 11, 2018 at 3:55 AM
        • Reply

        Thank you very much ! It does works!

        1. Glad to hear that!

    • Alfonso on December 1, 2015 at 11:09 AM
    • Reply

    Thank you! It works.
    I don’t know why, but it works.

Leave a Reply

Your email address will not be published.