From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Teodor Sigaev <teodor(at)sigaev(dot)ru> |
Subject: | Re: tsearch profiling - czech environment - take 55MB |
Date: | 2010-03-11 17:08:56 |
Message-ID: | 162867791003110908y18e4f0b3v4f2c62d62420f163@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
2010/3/11 Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>:
> 2010/3/11 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
>> Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> writes:
>>> There are some wrong in our implementation NISortDictionary. After
>>> initialisation is ts_cache memory context 55MB long and pg takes
>>> 190MB.
>>
>> What's your tsearch configuration exactly?
>>
I have a 64bit Linux.
The problem is in very large small allocations - there are 853215 nodes.
The memory can be minimalized with some block allocations
static void.
binit(void)
{
<------>data = NULL;
<------>allocated = 0;
}
static char *
balloc(size_t size)
{
<------>char *result;
<------>
<------>if (data == NULL || size > allocated )
<------>{
<------><------>data = palloc(1024 * 100);
<------><------>allocated = 1024 * 100;
<------>}
<------>
<------>result = data;
<------>data += size;
<------>allocated -= size;
<------>memset(result, 0, size);
<------>
<------>return result;
}
I replaced palloc0 inside mkSPnode by balloc
cspell: 25626352 total in 349 blocks; 11048 free (2 chunks); 25615304 used
Ispell dictionary init context: 27615288 total in 13 blocks; 7710864
free (34 chunks); 19904424 used
versus
cspell: 55853736 total in 6789 blocks; 130208 free (1553 chunks); 55723528 used
Ispell dictionary init context: 27615288 total in 13 blocks; 7710864
free (34 chunks); 19904424 used
Regards
Pavel
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2010-03-11 17:18:42 | Re: tsearch profiling - czech environment - take 55MB |
Previous Message | Zdenek Kotala | 2010-03-11 17:03:22 | Re: gothic_moth, codlin_moth failures on REL8_2_STABLE |