Is using malloc with pthreads safe? - Unix

This is a discussion on Is using malloc with pthreads safe? - Unix ; Just wondering if GNU malloc is thread-safe. I'm currently working on a project using malloc in multiple threads, and I'd rather find out now that have to sift through code to find a bug only to find out that it's ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: Is using malloc with pthreads safe?

  1. Is using malloc with pthreads safe?

    Just wondering if GNU malloc is thread-safe. I'm currently working on
    a project using malloc in multiple threads, and I'd rather find out now
    that have to sift through code to find a bug only to find out that it's
    malloc's fault. I tried looking for the answer on Google, but no such
    luck there...

    Thanks,
    Rob Hoelz

  2. Re: Is using malloc with pthreads safe?

    Rob Hoelz writes:

    > Just wondering if GNU malloc is thread-safe. I'm currently working on
    > a project using malloc in multiple threads, and I'd rather find out now
    > that have to sift through code to find a bug only to find out that it's
    > malloc's fault. I tried looking for the answer on Google, but no such
    > luck there...


    It's perfectly safe.

    --
    Måns Rullgård
    mans@mansr.com

  3. Re: Is using malloc with pthreads safe?

    On Oct 19, 3:46 pm, Rob Hoelz wrote:
    > Just wondering if GNU malloc is thread-safe. I'm currently working on
    > a project using malloc in multiple threads, and I'd rather find out now
    > that have to sift through code to find a bug only to find out that it's
    > malloc's fault. I tried looking for the answer on Google, but no such
    > luck there...
    >
    > Thanks,
    > Rob Hoelz


    Yes, it is safe.


  4. Re: Is using malloc with pthreads safe?

    Bin Chen wrote:

    > On Oct 19, 3:46 pm, Rob Hoelz wrote:
    > > Just wondering if GNU malloc is thread-safe. I'm currently working
    > > on a project using malloc in multiple threads, and I'd rather find
    > > out now that have to sift through code to find a bug only to find
    > > out that it's malloc's fault. I tried looking for the answer on
    > > Google, but no such luck there...
    > >
    > > Thanks,
    > > Rob Hoelz

    >
    > Yes, it is safe.
    >


    Awesome, thanks for the quick replies!

+ Reply to Thread