Обсуждение: How To free resources used by large object Relations?

Поиск
Список
Период
Сортировка

How To free resources used by large object Relations?

От
"Maurice Gittens"
Дата:
Hi,

I've changed the large object memory managment strategy to ensure that
each large object has it's own memory context.
This way I can free all memory for a large object when I lo_close
is called for it's oid. This seems to work.

I've noticed that the heap_close function used to close the heap used
by a large object doesn't really do any thing. (It calls RelationClose
which decrements some reference count).

Somehow I have to free the relation from the cache in the following
situations:
1. In a transaction I must free the stuff when the transaction is
commited/aborted.
2. Otherwise it must happen when lo_close is called.

Is this right?

Can anyone point me in the right direction?

Thanks Maurice.



Re: [HACKERS] How To free resources used by large object Relations?

От
Bruce Momjian
Дата:
>
> Hi,
>
> I've changed the large object memory managment strategy to ensure that
> each large object has it's own memory context.
> This way I can free all memory for a large object when I lo_close
> is called for it's oid. This seems to work.

This is a good idea.

>
> I've noticed that the heap_close function used to close the heap used
> by a large object doesn't really do any thing. (It calls RelationClose
> which decrements some reference count).
>
> Somehow I have to free the relation from the cache in the following
> situations:
> 1. In a transaction I must free the stuff when the transaction is
> commited/aborted.
> 2. Otherwise it must happen when lo_close is called.
>
> Is this right?
>

Beats me.

--
Bruce Momjian
maillist@candle.pha.pa.us

Re: [HACKERS] How To free resources used by large object Relations?

От
"Vadim B. Mikheev"
Дата:
Maurice Gittens wrote:
>
> Hi,
>
> I've changed the large object memory managment strategy to ensure that
> each large object has it's own memory context.
> This way I can free all memory for a large object when I lo_close
> is called for it's oid. This seems to work.
>
> I've noticed that the heap_close function used to close the heap used
> by a large object doesn't really do any thing. (It calls RelationClose
> which decrements some reference count).
>
> Somehow I have to free the relation from the cache in the following
> situations:
> 1. In a transaction I must free the stuff when the transaction is
> commited/aborted.

Backend does it, don't worry.

> 2. Otherwise it must happen when lo_close is called.

It seems that you can't remove relation from cache untill
commit/abort, currently: backend uses local cache to unlink
files of relations created in transaction if abort...
We could change relcache.c:RelationPurgeLocalRelation()
to read from pg_class directly...

But how many LO do you create in single xact ?
Is memory allocated for cache so big ?

Vadim