Subject Re: [firebird-support] Re: Firebird Restarting part 2
Author Vlad Horsun
Well, you have default values for sorting and page cache.

I wonder why do you use small cache for 8GB database on machine
with a lot of memory, but this is not about subject ;)

> > I can think about 3 possible ways to Firebird to reserve big
> amount of virtual memory and not use it:
> >
> > a) Large unused page cache
> >
> > Firebird reserved virtual memory of size of page buffer setting
> (in database header or in firebird.conf)
> > when first attachment to database is made. But Firebird can't use
> more pages than database file
> > have - so it reserved one amount of memory and used another if page
> buffer is greater than database
> > file itself
>
> Hmm - I didn't really understand all of it to the full.
> But is there a way to change some settings in order to have do it
> diffrent ?

It seems this is not a problem for you. If you change DefaultDbCachePages
to, say, 100000 then Firebird will reserve 100000 * page_size (usually 4KB)
bytes of memory for every attached database. If database is small, say, 1000
pages, then 99000 * page_size bytes of reserved memory will be never used.
Imagine server with such crazy settings served 10 databases :)

> > b) many simultaneous sortings
> >
> > Firebird reserved memory for sorting by SortMemBlockSize chunks
> (no more than SortMemUpperLimit)
> > of course it can use less memory then SortMemBlockSize
>
> They do a lot of sorting.
> Especially some of the rutines during the day creates 3 - 4 reports
> that selects some 500 - 2000 records from a table containing some 8
> mill. records.
> I have looked at the sql, and it does use an index to retrieve the
> records. And the index has just recently had a set statistics (besides
> - There are only insert and updates (updates are not in index fields)
> in this table. No delete).
>
> The last few days I have monitored the memory use, and tried to see
> what people where doing at the time when memory cunsumption suddenly
> increased. If what I suspect is rigth it seems as if the memory
> increases when creating some reports (which users often do at the same
> time). But I'm not certain yet....

If you can catch query consuming much memory it will be good hint

> Can I in some way tweak these as well ?

Sorting is also must not be a your problem as you not raised SortMemUpperLimit

> > c) some memory leak
> >
> > It is possible you faced with some memory leak in Firebird but
> much more probably in some UDF.
> > But i can't imagine memory leak when physical memory is unused...
>
> We don't use any UDF.

I recollected one more possible case when memory allocated but not used - are
you have something like statement cache in your application ? Are you sure you
close all statement handles ? How many statements can be allocated in all
instances of your application simultaneously ?

Every statement have it's own memory pool at least 64KB

Regards,
Vlad