[omniORB] memory leak in omni_thread

Andreas Koehler Andreas.Koehler@vs.dasa.de
Wed, 19 May 1999 17:25:42 +0200 (MEST)


Hi, everyone  

I tried to port our CorbaService to OmniORB2 using version 2.7.1 on
DigitalUnix OSF1 4.0d. The example below demonstrates the way we deal
with omni_threads. May be we made some mistake or there is a memory leak
in omni_thread::create - some seconds after starting the program
terminates in handling an exception from omni_thread::create caused by a
failed memory allocation.

#include <stdlib.h>
#include <iostream.h>
#include <omnithread.h>
#include <omniORB2/CORBA.h>

void* thread_adapter (void *param) {
  return NULL;
}

int main(int argc, char **argv) {
    omni_thread *thr = NULL;
    while (true) {
        try {
            thr = omni_thread::create(thread_adapter, NULL,
                                      omni_thread::PRIORITY_LOW);
            cout << "."; cout.flush();
        } catch (...) {
            cout << endl << "omni_thread::create raised an exception" <<
                    endl;
            exit(-1);
        }
    }
}

Compilation was done with:
  cxx -c -I/usr/local/include -D__alpha__ -D__osf1__ -D__OSVERSION__=4
         -D_REENTRANT ot.cc -o ot.o
Linking was done with:
  cxx -o ot ot.o -lomnithread

The cxx version is 6.0.

Thanx for any answers.
Andreas