[omniORB] Memory problem on NT

Boris Khanales boris@imagine-sw.com
ed, 18 Nov 1998 09:38:52 -0500


I'm runing omni 2.6.1 on NT and Solaris.
On NT side I see memory problem. Can anybody tell
me plase what do I do wrong ?????


idl:


interface Test
{
    struct Datum1
    {
        string tag_;
        any val_;
    };

    typedef sequence<Datum1> Datum2;
    typedef sequence<Datum2> Datum;

    void foo2( in Datum dat );

};


Client side on Solaris:
                cout << "foo2" << endl;
    
                Datum1 stru;
                stru.tag_ = "1234";
                const char* testStr = "123456789";
                stru.val_ <<= testStr;
    
                Datum2 seq2(2);
                seq2.length(2);
                seq2[0] = stru;
                seq2[1] = stru;
    
                Datum datum(100);
                datum.length(100);
                for ( int dtCnt=0; dtCnt<100; dtCnt++ )
                {
                    datum[dtCnt] = seq2;
                }
    
                system("date");
                for( int i=0; i<10000;i++)  // 10000
                    e->foo2( datum );
                system("date");



Server side on NT:


void TestImpl::foo2( const Datum& dat )
{
    long datLen = dat.length();

    for( int i=0; i<datLen; i++ )
    {

        const Datum2& dat2 = dat[i];
        for( unsigned long j=0;j<dat2.length(); j++ )
        {
            const Datum1& dat1 = dat2[j];

            const char* tag = dat1.tag_;
            char* val;
            dat1.val_ >>= val;


		// Do I need this ???? It still memory lick
			free( val );
			free( const_cast<char*>(tag) );

//            cout << tag << "\t" << val << "\t\t";

        }
//        cout << endl;

    }
//    cout << endl << endl << endl;
}