My Informix Never free up memory!
Posted in 2003
An ESQL/C program looping inserts/updates over ~90,000 rows caused Informix OnLine 7.22 shared memory to balloon to ~750MB on a 128MB box, with one session showing ~422MB of session memory, and memory never being released. Replies said nothing in ONCONFIG causes this and pointed at the program: look for a leak and missing FREE of prepared statement ids/resources, possibly using the 'clint' C code checker; Jonathan Leffler also noted BUFFERS=500 was far too low. The poster found no leak, and another reader questioned whether the growth was client- or server-side. No resolution is recorded in the thread.
Auto-generated by DrWatson from the posts below — may be imperfect; read the full thread.
Topics: Performance & Tuning, Connectivity: ESQL/C, 4GL & Embedded SQL, Logging & Checkpoints
Hi, group
My ESQL/C program run a insert/update loop to load about 90,000
records from data file into tables. During run, I foud the share
memory size kept growing from it's initial size to 750M! My box only
got 128M physical RAM, I think it is a big performance problem for
Informix will cause a large disk swapping, won't it?
Can anyone please tell me why Informix dont' free memory after every
excuttion of insert/update sql? I think I already free every sql id
after prepare & execute it. In fact, even after exit of the program,
the share memory size still dont go down. What it means?
Below is some run time info, can anyone please checks and gives me and
advice.
1, Tranaction logs is turned off for databases I operated on.
2, Shared Memory Parameters
LOCKS 80000 # Maximum number of locks
BUFFERS 500 # Maximum number of shared buffers
NUMAIOVPS # Number of IO vps
PHYSBUFF 2048 # Physical log buffer size (Kbytes)
LOGBUFF 2048 # Logical log buffer size (Kbytes)LOGSMAX 20 # Maximum number of logical log files
CLEANERS 1 # Number of buffer cleaner processes
SHMBASE 0x82000000 # Shared memory base address
SHMVIRTSIZE 81920 # initial virtual shared memorysegment size
SHMADD 20480 # Size of new shared memory segments
(Kbytes)
SHMTOTAL 0 # Total shared memory (Kbytes).
0=>unlimited
CKPTINTVL 1800 # Check point interval (in sec)
LRUS 8 # Number of LRU queues
LRU_MAX_DIRTY 60 # LRU percent dirty begin cleaninglimit
LRU_MIN_DIRTY 50 # LRU percent dirty end cleaning limit
LTXHWM 50 # Long transaction high water markpercentage
LTXEHWM 60 # Long transaction high water mark
(exclusive)
TXTIMEOUT 0x12c # Transaction timeout (in sec)
STACKSIZE 64 # Stack size (Kbytes)
3, onstat -b
INFORMIX-OnLine Version 7.22.UC2 -- On-Line -- Up 15:13:00 -- 754408
Kbytes
Buffers
address userthread flgs pagenum memaddr nslots pgflgs xflgs owner
waitlist
825a5a2c 0 23 395cdf 82fb9800 3 1 10 0
0
825a86dc 0 23 39bada 82ff0800 3 1 10 0
0
825ad4dc 0 23 395cdd 83050800 3 1 10 0
0
278 modified, 500 total, 512 hash buckets, 2048 buffer size
4, onstat -p
INFORMIX-OnLine Version 7.22.UC2 -- On-Line -- Up 15:19:48 -- 754408
Kbytes
Profile
dskreads pagreads bufreads %cached dskwrits pagwrits bufwrits %cached
103425 104107 30929193 99.67 49203 92680 837271 94.12
isamtot open start read write rewrite delete commit
rollbk
19291051 1633683 2082423 11202078 203016 122600 0 0
0
ovlock ovuserthread ovbuff usercpu syscpu numckpts flushes
0 0 0 1855.32 200.83 4 62
bufwaits lokwaits lockreqs deadlks dltouts ckpwaits compress
seqscans
39330 0 24964352 0 0 2 0 29
ixda-RA idx-RA da-RA RA-pgsused lchwaits
50464 0 132 50556 300
5, onstat -g ses
INFORMIX-OnLine Version 7.22.UC2 -- On-Line -- Up 15:20:24 -- 754408
Kbytes
session #RSAM total used
id user tty pid hostname threads memory memory
15 informix - 0 - 0 8192 4588
14 informix ttyp0 2712 lczmdbsv 1 422092800
422053416
8 informix - 0 - 0 8192 4588
6 informix - 0 - 0 8192 4588
5 informix - 0 - 0 16384 12224
4 informix - 0 - 0 16384 12224
3 informix - 0 - 0 8192 4588
2 informix - 0 - 0 8192 4588
steven wrote:
> Hi, group
>
> My ESQL/C program run a insert/update loop to load about 90,000
> records from data file into tables. During run, I foud the share
> memory size kept growing from it's initial size to 750M! My box only
> got 128M physical RAM, I think it is a big performance problem for
> Informix will cause a large disk swapping, won't it?
>
> Can anyone please tell me why Informix dont' free memory after every
> excuttion of insert/update sql? I think I already free every sql id
> after prepare & execute it. In fact, even after exit of the program,
> the share memory size still dont go down. What it means?
>
> Below is some run time info, can anyone please checks and gives me and
> advice.
>
> 1, Tranaction logs is turned off for databases I operated on.
>
> 2, Shared Memory Parameters
>
> LOCKS 80000 # Maximum number of locks
> BUFFERS 500 # Maximum number of shared buffers
> NUMAIOVPS # Number of IO vps
> PHYSBUFF 2048 # Physical log buffer size (Kbytes)
> LOGBUFF 2048 # Logical log buffer size (Kbytes)
Your buffers are vastly underconfigured - 50000 would be a starting
point, and go up from there.
However, your ESQL/C program is going to more relevant to debugging
the memory leak. There's nothing in the ONCONFIG file that says "leak
memory" or "do not free memory". Gut feel, you should be looking at
the free statements in your program.
--
Jonathan Leffler #include <disclaimer.h>
Email: jleffler@earthlink.net, jleffler@us.ibm.com
Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org/
You need to review your code, you appear to have a memory leak
and/or you are not freeing resources as you should. You could throw
clint at the code, it's very good at spotting problems
steven wrote:
>
> Hi, group
>
> My ESQL/C program run a insert/update loop to load about 90,000
> records from data file into tables. During run, I foud the share
> memory size kept growing from it's initial size to 750M! My box only
> got 128M physical RAM, I think it is a big performance problem for
> Informix will cause a large disk swapping, won't it?
>
> Can anyone please tell me why Informix dont' free memory after every
> excuttion of insert/update sql? I think I already free every sql id
> after prepare & execute it. In fact, even after exit of the program,
> the share memory size still dont go down. What it means?
>
> Below is some run time info, can anyone please checks and gives me and
> advice.
>
> 1, Tranaction logs is turned off for databases I operated on.
>
> 2, Shared Memory Parameters
>
> LOCKS 80000 # Maximum number of locks
> BUFFERS 500 # Maximum number of shared buffers
> NUMAIOVPS # Number of IO vps
> PHYSBUFF 2048 # Physical log buffer size (Kbytes)
> LOGBUFF 2048 # Logical log buffer size (Kbytes)> LOGSMAX 20 # Maximum number of logical log files
> CLEANERS 1 # Number of buffer cleaner processes
> SHMBASE 0x82000000 # Shared memory base address
> SHMVIRTSIZE 81920 # initial virtual shared memory> segment size
> SHMADD 20480 # Size of new shared memory segments
> (Kbytes)
> SHMTOTAL 0 # Total shared memory (Kbytes).
> 0=>unlimited
> CKPTINTVL 1800 # Check point interval (in sec)
> LRUS 8 # Number of LRU queues
> LRU_MAX_DIRTY 60 # LRU percent dirty begin cleaning> limit
> LRU_MIN_DIRTY 50 # LRU percent dirty end cleaning limit
> LTXHWM 50 # Long transaction high water mark> percentage
> LTXEHWM 60 # Long transaction high water mark
> (exclusive)
> TXTIMEOUT 0x12c # Transaction timeout (in sec)
> STACKSIZE 64 # Stack size (Kbytes)>
> 3, onstat -b
> INFORMIX-OnLine Version 7.22.UC2 -- On-Line -- Up 15:13:00 -- 754408
> Kbytes
>
> Buffers
> address userthread flgs pagenum memaddr nslots pgflgs xflgs owner
> waitlist
> 825a5a2c 0 23 395cdf 82fb9800 3 1 10 0
> 0
> 825a86dc 0 23 39bada 82ff0800 3 1 10 0
> 0
> 825ad4dc 0 23 395cdd 83050800 3 1 10 0
> 0
> 278 modified, 500 total, 512 hash buckets, 2048 buffer size
>
> 4, onstat -p
> INFORMIX-OnLine Version 7.22.UC2 -- On-Line -- Up 15:19:48 -- 754408
> Kbytes
> Profile
> dskreads pagreads bufreads %cached dskwrits pagwrits bufwrits %cached
> 103425 104107 30929193 99.67 49203 92680 837271 94.12
> isamtot open start read write rewrite delete commit
> rollbk
> 19291051 1633683 2082423 11202078 203016 122600 0 0
> 0
> ovlock ovuserthread ovbuff usercpu syscpu numckpts flushes
> 0 0 0 1855.32 200.83 4 62
> bufwaits lokwaits lockreqs deadlks dltouts ckpwaits compress
> seqscans
> 39330 0 24964352 0 0 2 0 29
> ixda-RA idx-RA da-RA RA-pgsused lchwaits
> 50464 0 132 50556 300
>
> 5, onstat -g ses
> INFORMIX-OnLine Version 7.22.UC2 -- On-Line -- Up 15:20:24 -- 754408
> Kbytes
> session #RSAM total used
> id user tty pid hostname threads memory memory
> 15 informix - 0 - 0 8192 4588
> 14 informix ttyp0 2712 lczmdbsv 1 422092800
> 422053416
> 8 informix - 0 - 0 8192 4588
> 6 informix - 0 - 0 8192 4588
> 5 informix - 0 - 0 16384 12224
> 4 informix - 0 - 0 16384 12224
> 3 informix - 0 - 0 8192 4588
> 2 informix - 0 - 0 8192 4588
--
Paul Watson #
Oninit Ltd # Growing old is mandatory
Tel: +44 1436 672201 # Growing up is optional
Fax: +44 1436 678693 #
Mob: +44 7818 003457 #
www.oninit.com #
Paul Watson <paul@oninit.com> wrote in message news:<3F6432B8.E225C65A@oninit.com>... > You need to review your code, you appear to have a memory leak > and/or you are not freeing resources as you should. You could throw > clint at the code, it's very good at spotting problems what you mean 'throw clint'? I dont understand, could you tell me more? thanks! -- steven@lczmsoft.com
Jonathan Leffler <jleffler@earthlink.net> wrote in message news:<84U8b.2850$BS5.1636@newsread4.news.pas.earthlink.net>... > Your buffers are vastly underconfigured - 50000 would be a starting > point, and go up from there. > I skimed through the Informix Performance Guide, it said, that the BUFFERS should be about 20% - 25% of physical memory size. For my host equipment with 128M physical memory and page size if 2k, so I think 50000 is too large to me. Should I set it to about 15000? > However, your ESQL/C program is going to more relevant to debugging > the memory leak. There's nothing in the ONCONFIG file that says "leak > memory" or "do not free memory". Gut feel, you should be looking at > the free statements in your program. I still dont find any leak in my code :-(, is there any quite easy tool?
Do a web search for clint - its a c-code checker - it's very good steven wrote: > > Paul Watson <paul@oninit.com> wrote in message news:<3F6432B8.E225C65A@oninit.com>... > > You need to review your code, you appear to have a memory leak > > and/or you are not freeing resources as you should. You could throw > > clint at the code, it's very good at spotting problems > > what you mean 'throw clint'? I dont understand, could you tell me more? thanks! > > -- > steven@lczmsoft.com -- Paul Watson # Oninit Ltd # Growing old is mandatory Tel: +44 1436 672201 # Growing up is optional Fax: +44 1436 678693 # Mob: +44 7818 003457 # www.oninit.com #
steven@steven4u.net (steven) writes: > Hi, group > > My ESQL/C program run a insert/update loop to load about 90,000 > records from data file into tables. During run, I foud the share > memory size kept growing from it's initial size to 750M! My box only > got 128M physical RAM, I think it is a big performance problem for > Informix will cause a large disk swapping, won't it? > > Can anyone please tell me why Informix dont' free memory after every > excuttion of insert/update sql? I think I already free every sql id > after prepare & execute it. In fact, even after exit of the program, > the share memory size still dont go down. What it means? > > Below is some run time info, can anyone please checks and gives me and > advice. Can you pleasy clarify if this supposed memory leakage happens in the client or in the server? From your post I suspect you're talking about the server, but the answers here have all been talking about the client. 128M physical RAM is not very much these days, to put it mildly. -- 'yvind Gjerstad Systems dept Tollpost-Globe AS N-6301 'ndalsnes/Norway E-mail: ogj@tollpost.no Phone: +47 7122 6663 Fax: +47 7122 6694
Related threads
- onbar -c -F in Windows Informix instance
- Anyone... SQLCODE=-668, ISAM error=-1
- Not using the 100% logical log page size alloacted to informix