[unixODBC-support] Memory leak in SQLFetch?

Saunders, Steve ssaunders at docucorp.com
Tue Dec 14 16:19:35 GMT 2004


Nick wrote:

>Saunders, Steve wrote:
>
>>
>>  
>>
>>>Craddock, Richard C wrote:
>>>    
>>>
>>
>>  
>>
>>>>Ladies and Gentlemen:
>>>>
>>>>
>>>>
>>>>I have a reproducible memory leak with the attached code.  There are 
>>>>exactly 20160 elements that should be returned from the query.  After 
>>>>running this program there is nearly 3Mb of un-freed memory.  If I 
>>>>comment out the SQLFetch() calls then the memory leak goes away.  I 
>>>>suspect that it may have something to do with how I am using unixODBC 
>>>>rather then a memory leak in unixODBC.  But I have stared at the code 
>>>>for quite sometime to no avail.  Has anyone had a similar problem?  
>>>>Have I made a mistake somewhere?  I appreciate your time and assistance.
>>>>
>>>> 
>>>>
>>>>Regards,
>>>>
>>>>Cameron Craddock
>>>>
>>>>     
>>>>
>>
>>Nick wrote
>>  
>>
>>>From a quick read, it looks ok, but it does depend on the driver as 
>>>well, what driver is this using ?
>>>
>>>When you have these sorts of problems, its often worth just trying the 
>>>same thing with another database/driver to see if the leak remains.
>>>    
>>>
>>
>>
>>Mr. Craddock, 
>>
>>What version of unixODBC and OS are you using for this memory leak test? 
>>
>>We see a similar memory leak problem with unixODBC v2.2.9 regardless of DB
>>driver (DB2 or MyODBC/MySQL.   We have only tested this version of
unixODBC
>>on AIX v5.2.  The same tests on unixODBC v2.2.8 on Linux/RedHat does not
>>appear to leak.  
>>
>>-Steve
>>  
>>
>
>Hmm,
>
>Is it possible the cursor lib being used, and this is contributing to 
>the problem ?
>

A little new to unixODBC at this level, how would I know?  Is there a change
for the SQLFetch in v2.2.9 vs. v2.2.8 and earlier using the cursor lib? 
I see the ./cur directory in the source code tree and some note that cursor
support was added for SELECTs without where clauses in the ./cur/SQLFetch.c
comments.  
My program does not link to libodbccr.a or libodbccr.so and I don't see that
library reference in any of the Makefiles in the unixODBC tree except for
the ./cur/Makefile.    





More information about the unixODBC-support mailing list