Memroy related Issue ( Please help) - HP UX

This is a discussion on Memroy related Issue ( Please help) - HP UX ; Hi All, I have two version of a c program on HPUX-11.2. First is without threading, and second is with threading in which I could chose how much thread or no threads to use. I run first one, and check ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Memroy related Issue ( Please help)

  1. Memroy related Issue ( Please help)

    Hi All,

    I have two version of a c program on HPUX-11.2.
    First is without threading, and second is with threading in which I
    could chose how much thread or no threads to use.

    I run first one, and check memory usage thru glance and note the memory
    usage in DATA segment for whole run.
    Now I run the second one and view the memory usage thru glance then I
    foun the memory usage are just double from the start.
    I have run with 0 threads option too, yet it's occupying double memory.
    while database is same.

    I have tried with commenting the initialization part which is used for
    threads, still no clue. and results are same.

    Now I am trying to compile it using purifier, but still I need your
    kind suggestions, that where I am missing , or what approach I should
    follow.

    Thanks in advace.

    Regards
    Sunil Somani


  2. Re: Memroy related Issue ( Please help)

    Hi Sunil,

    The behavior you observed is pretty much expected.
    Even though in the second version of the program, you are not creating
    any threads, the moment you link with the libpthread library, there is
    a some significant memory overhead implicitly introduced. The C library
    (libc) will have to do some considerable additional initialization.
    Concepts such as TLS (thread local storage) will come into play.
    Eventhough, the program may single threaded, libc will have to play
    safe (acquiring and releasing locks, when dealing with global or static
    data).
    Also, the pthread library will have to "setup the scene" for multiple
    threads.

    Hope this explains your question.

    Thanks!
    -Rajesh

    som wrote:
    > Hi All,
    >
    > I have two version of a c program on HPUX-11.2.
    > First is without threading, and second is with threading in which I
    > could chose how much thread or no threads to use.
    >
    > I run first one, and check memory usage thru glance and note the memory
    > usage in DATA segment for whole run.
    > Now I run the second one and view the memory usage thru glance then I
    > foun the memory usage are just double from the start.
    > I have run with 0 threads option too, yet it's occupying double memory.
    > while database is same.
    >
    > I have tried with commenting the initialization part which is used for
    > threads, still no clue. and results are same.
    >
    > Now I am trying to compile it using purifier, but still I need your
    > kind suggestions, that where I am missing , or what approach I should
    > follow.
    >
    > Thanks in advace.
    >
    > Regards
    > Sunil Somani



+ Reply to Thread