Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / Informix Topics / February 2004

Tip: Looking for answers? Try searching our database.

ESQL/C memory leak while working with LVARCHAR data (on Win32)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sergey V. Buturlakin - 26 Feb 2004 20:00 GMT
While working with lvarchar data on win32 platform I'd trap on serious
memory leak when such data is deallocated. Here is simple ESQL/C
program:

#include <stdio.h>

int main()
{
 EXEC SQL BEGIN DECLARE SECTION;
 lvarchar *_value;
 EXEC SQL END DECLARE SECTION;
 char testdata[100];
 int i;

 for (i = 0; i < 10000000; i++)
 {
   _value = 0;
   ifx_var_flag(&_value, 0);
   ifx_var_alloc(&_value, 101);
   ifx_var_setlen(&_value, 100);
   ifx_var_setdata(&_value, testdata, 100);
   ifx_var_init(&_value);
   ifx_var_dealloc(&_value);
 }

 getchar();
}

When this program is running memory used by it's process grows
extremely fast.
Does anybody have any expirience with such problem ?

P.S. Informix CSDK 2.80TC2 was used.

--
With best regards
BSV
hobbes - 27 Feb 2004 07:54 GMT
Just for information...

I just compile and launch

and : it works the same for me ....
It grows .....

I can't find any doc on the functions....
So i do not even know what it does

Windows with : CSDK 2.81TC2

> While working with lvarchar data on win32 platform I'd trap on serious
> memory leak when such data is deallocated. Here is simple ESQL/C
[quoted text clipped - 33 lines]
> With best regards
> BSV
Sergey V. Buturlakin - 27 Feb 2004 15:07 GMT
These functions in such sequence are used to pass lvarchar parameter
in SQL (see ESQL/C reference, part where work with lvarchar type is
described).

But I also detect that troubles have place when lvarchar data is
fetched. Memory profiler reports 16 bytes memory leak on each
ifx_var_flag call.

> Just for information...
>
[quoted text clipped - 35 lines]
> >   getchar();
> > }
Art S. Kagel - 27 Feb 2004 13:26 GMT
Happens on Linux also.  The memory usage grows to over 230MB.

Art S. Kagel

> While working with lvarchar data on win32 platform I'd trap on serious
> memory leak when such data is deallocated. Here is simple ESQL/C program:
[quoted text clipped - 31 lines]
> With best regards
> BSV
Abhishek Mathur - 27 Feb 2004 19:54 GMT
Hello,
       Please read the description of ifx_var_dealloc() again. It states
Signature

ifx_var_dealloc()
The ifx_var_dealloc() function deallocates the memory that was allocated
for
the data buffer of a var binary host variable.

       Now, in the repro that you have provided, the data buffer maybe
deallocated, but the pointer is still not allocated. For this to
deallocate, we have another API -
ifx_var_freevar()
The ifx_var_freevar() function frees memory that has been allocated for
the
var binary and lvarchar pointer host variables.

       Please use the ifx_var_freevar() to deallocate the pointer
associated with lvarchar pointer host variable. For more information on
this, please refer to the latest ESQl/C Manual at -
http://publibfi.boulder.ibm.com/epubs/pdf/ct1uhna.pdf  Page B-260.

       Simply adding ifx_var_freevar(&_value); within the loop, should
resolve the problem of the memory leak that you are getting and you should
not see the memory grow then.

Thanks and Regards,
Abhi.
--------------------------------------------------------------------
There are 10 kinds of people,,,,,
.... those who understand binary notations, and those who don't.
--------------------------------------------------------------------

"Art S. Kagel" <kagel@bloomberg.net>
Sent by: owner-informix-list@iiug.org
02/27/2004 07:26 AM
Please respond to
kagel

To
informix-list@iiug.org
cc

Subject
Re: ESQL/C memory leak while working with LVARCHAR data (on Win32)

Happens on Linux also.  The memory usage grows to over 230MB.

Art S. Kagel

> While working with lvarchar data on win32 platform I'd trap on serious
> memory leak when such data is deallocated. Here is simple ESQL/C
program:

> #include <stdio.h>
>
[quoted text clipped - 28 lines]
> With best regards
> BSV

sending to informix-list
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.