[omniORB] memory leak in omni_thread

David Riddoch djr@uk.research.att.com
Wed, 19 May 1999 16:37:00 +0100 (GMT)



Andreas,


You are creating low priority threads. They never get a chance to run
because the main thread has normal priority - and thus threads just
accumulate until you run out of resources.


Hope that helps,
David




On Wed, 19 May 1999, Andreas Koehler wrote:

> 
> 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
> 
> 
> 
>