Severe memory leak in global pool: mgm_query
Posted in 2003
Hi, everybody,
After taking a look at the size of memory pools (onstat -g mem)
on our machine, I was shocked : it appeared, that the size of global
pool is 138 MB!!!
Informix Dynamic Server 2000 Version 9.21.UC4 -- On-Line (Prim) -- Up 22
days 14:11:09 -- 1790448 Kbytes
Pool Summary:
name class addr totalsize freesize #allocfrag #freefrag
.........
global V 8f816020 134889472 1006776 518347 6502
.........
This global pool can't be reduced by 'onmode -F'
(its 'free' size is too small)
I've made an attempt to analyze this pool with
'onstat -g afr global'. The resulting file was 16 MB in size
mostly contained records like:
Allocations for pool name global:
addr size memid
.....
8f8199d8 240 mgm_query
8f819ac8 240 mgm_query
.....
This is total statistics of that file:
Total_bytes #fragmets fragment_name
-------------------------------------------
40 1 messages
48 1 fragman
56 1 initseg
56 1 shmblklist
160 4 Log
280 1 filetable
280 1 opentable
280 1 hashfiletab
456 1 mgm
568 1 gentcb
1496 1 SAPI
1832 3 overhead
2592 1 ostcb
3648 8 rsam
4528 11 sql
6392 107 misc
7432 163 osenv
19256 310 mcbmsg
41024 2 btcleaner
73528 69 scb
274944 2 aio
559144 139 log
3147248 13 datarep
5822416 3060 net
122795024 509837 mgm_query
------------------------------------------
That is, this memory leak is caused by MGM_QUERY fragments:
We have 509837 fragments 240 bytes each, 122 MB in total !!!!
I have a suspicion, that 'mgm' here stays for 'memory grant manager',
that is, memory leak is caused by PDQ (parallel data query) queries!
I've attempted to make a search in the PDQ (product defect query) tool,
and was unable to find anything similar.
By making further experiments with PDQ queries and running simple script
in parallel (onstat -g afr global | grep mgm_query | wc -l), I've found,
that each PDQ query allocates from 4 to 1000 mgm_query fragments
and doesn't release them to the system upon completion!!!
Hey, Informix tech-support, can You file a bug in Your 'Atlas',
or whatever You use now at IBM?
------------------------------------------
Alexey Sonkin
Senior Database Administrator