Subject Re: [firebird-support] gbak Out of Memory
Author Helen Borrie
At 05:02 PM 27/02/2010, you wrote:
>I have a Firebird DB (Ver 2.1) of 566 Mbyte.
>The customer has of misstake turned off garbage collection and the size of the database increased and fbserver starts to consume a lot of memory

I don't know what you are referring to here. You can't "turn off" garbage collection. If it is Superserver that your customer is running, it will be affected in some way by the GCPolicy. The default is 'mixed': the alternatives are 'background' and 'cooperative'. 'Mixed' performs a mixture of the other two. Try setting it to 'background' and see whether that helps to reduce the "hit" you are apparently getting from having coop in the mix.

If it is Classic, the GCPolicy is always 'cooperative', regardless of how it is configured.

I wonder whether your customer's "mistake" was really in setting the SweepInterval to 0. Normally this is a good idea in a database like this that is apparently accumulating a lot of garbage - BUT he will need to run a sweep every day when the users have signed off.

>I took a copy of the db to my computer, but get the following message when I try "gfix -mend" or "gbak -B":
> - Unable to allocate memory from operating system. -

Run a sweep and see whether that helps. Otherwise, run gbak -b with the -g switch (for no garbage collection). Then, rename the database and perform a restore from the backup.

Do NOT run gfix -mend!!!! That is used *ONLY* as part of a data corruption procedure involving other gfix validation tools and should never be run without a number of preceding steps. For more information about that, see

But there is no sign that you have any corruption to mend. If you try to use the gfix -mend tool on a database that is not broken, you are likely to lose data that was perfectly OK before you did that. A big buildup of garbage is not corruption, it is a sign that the program is not managing transactions properly.

>Fbserver starts to consume a lot of memory and after a while the operation fails.
>Any idea of how to save this database?

Hopefully you haven't broken it by diving in head first. Take the suggested steps to try and clear out the garbage. Note that sweep might take quite a while, but the follow-up gbak -b -g should be quick and should not overtax memory.