memory leaks with pthread_key_delete

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Alvaro

    memory leaks with pthread_key_delete

    Hi!
    I have a problem with this code:
    #include <pthread.h>
    #include <iostream.h>
    int main(int argc, char** argv)
    {
    while(1)
    {
    pthread_key_t m_key;
    if (pthread_key_cr eate(&m_key,NUL L))
    cerr<<"Error en create"<<endl<< flush;
    if (pthread_key_de lete(m_key))
    cerr<<"Error en delete"<<endl<< flush;
    }
    };

    This code is leaking memory in each iteration and i don't know where is the
    problem. This program is ran with Solaris Operation System, and the compiler
    is SUN CC 6.0.

    Thanks, Alvaro


  • Adam Fineman

    #2
    [OT] Re: memory leaks with pthread_key_del ete

    Alvaro wrote:[color=blue]
    > Hi!
    > I have a problem with this code:
    > #include <pthread.h>
    > #include <iostream.h>
    > int main(int argc, char** argv)
    > {
    > while(1)
    > {
    > pthread_key_t m_key;
    > if (pthread_key_cr eate(&m_key,NUL L))
    > cerr<<"Error en create"<<endl<< flush;
    > if (pthread_key_de lete(m_key))
    > cerr<<"Error en delete"<<endl<< flush;
    > }
    > };
    >[/color]
    Firstly, lose the semicolon after the closing brace of main().

    Secondly, this query would be on topic on comp.programmin g threads.

    - Adam

    --
    Reverse domain name to reply.

    Comment

    Working...