CS/CT-lib: memory leaks 
Author Message
 CS/CT-lib: memory leaks

Running this simple program with Purify 3.0, I have noticed unexplicable memory
leaks (19 bytes):

#include <stdlib.h>
#define COMPILE_STYLE CPP_COMPILE
#include <ctpublic.h>

void main()
{
        CS_RETCODE      retcode;
        CS_CONTEXT    *_context;

   _context = NULL;

   // Allocates structure for _context.
   if ((retcode = cs_ctx_alloc(CS_VERSION_100,
                               &_context)) != CS_SUCCEED)
                               exit(1);

   // Initialize Open Client.
   if ((retcode = ct_init(_context,
                          CS_VERSION_100)) != CS_SUCCEED)
   {
      (void)cs_ctx_drop(_context);
      _context = NULL;
         exit(1);
   }

   if (((retcode = ct_exit(_context,
              CS_FORCE_EXIT)) != CS_SUCCEED) ||
       ((retcode = cs_ctx_drop(_context)) != CS_SUCCEED))
         exit(1);
   exit(0);

Quote:
}

Purify shows 19 bytes leaked with this stack:

        This memory was allocated from:
               malloc         [rtlib.o]
               net_init       [libtcl.sl]
               np_init        [libct.sl]
               ct_gp_init     [libct.sl]
               uwss_999       [libct.sl]
               ct_init        [libct.sl]

Is there anyone that has experienced this problem ?
I am working with HP C++ compiler and Sybase version 10.0.2 with CT-lib ver.
5.0
(I read the file ctpublic.h).
TIA,
Filippo

--
| Filippo Onorato            | Senior Software Engineer    |
| via dei Castori 13         | Sodalia S.p.A.              |
| Martignano, 38040 Trento   | via Brennero 364 38100 TN   |



Sun, 07 Dec 1997 03:00:00 GMT
 CS/CT-lib: memory leaks



Quote:
>Running this simple program with Purify 3.0, I have noticed unexplicable memory
>leaks (19 bytes):

[...snip...]

Quote:
>Purify shows 19 bytes leaked with this stack:

>        This memory was allocated from:
>               malloc         [rtlib.o]
>               net_init       [libtcl.sl]
>               np_init        [libct.sl]
>               ct_gp_init     [libct.sl]
>               uwss_999       [libct.sl]
>               ct_init        [libct.sl]

>Is there anyone that has experienced this problem ?
>I am working with HP C++ compiler and Sybase version 10.0.2 with CT-lib ver.
>5.0

Have you tried performing quite a few transactions, and/or a bunch of
inits and exits?  It would be interested to know if this is really a memory
leak, or if CT-LIB is keeping around small pool of memory on purpose.  The
only time that I claimed CT-LIB had a memory leak turned out to be my
fault (although, obviously, in the above example it has to be CT-LIB).

-scott



Sun, 07 Dec 1997 03:00:00 GMT
 CS/CT-lib: memory leaks
Sybase technical support gave me the solution:
patch EBF 4655 that fixes the problem with ct_init together with a similar
problem with ct_connect. In total, 28 bytes were lost by the two functions.
Thanks a lot,
Filippo Onorato  
--
| Filippo Onorato            | Senior Software Engineer    |
| via dei Castori 13         | Sodalia S.p.A.              |
| Martignano, 38040 Trento   | via Brennero 364 38100 TN   |



Mon, 08 Dec 1997 03:00:00 GMT
 CS/CT-lib: memory leaks
It was a known problem: ct_init and ct_connect loose 28 byte every time they
are used. I am waiting for a patch from Sybase technical support (EBF 4655, I
guess).
Filippo

--
| Filippo Onorato            | Senior Software Engineer    |
| tel.+39-461-316-243 direct | Sodalia S.p.A.              |
| fax +39-461-316-663        | via Brennero 364 38100 TN   |



Sun, 14 Dec 1997 03:00:00 GMT
 
 [ 4 post ] 

 Relevant Pages 

1. Memory leak in CT-Lib?

2. CT/CS lib and USER DATA

3. CS/CT-lib SRV_PROC to CS_CONTEXT

4. connection between sybase ct-lib and sql 8.0 ct-lib

5. Help! CT-Lib vs DB-Lib

6. OpenClient / TDS / DB-Lib / CT-Lib

7. Locking db-lib vs: ct-lib

8. can DB-Lib and CT-Lib coexist?

9. CT Lib vs DB Lib What's the Diff

10. DB-Lib vs CT-Lib

11. Advantages of CT-Lib over DB-Lib ???


 
Powered by phpBB® Forum Software