Share state ( allocated memory ) across two C functions...

From: "Maksim Likharev" <mlikharev(at)aurigin(dot)com>
To: <pgsql-hackers(at)postgresql(dot)org>, <pgsql-general(at)postgresql(dot)org>
Subject: Share state ( allocated memory ) across two C functions...
Date: 2003-06-30 22:57:26
Message-ID: 56510AAEF435D240958D1CE8C6B1770A016D2D7D@mailc03.aurigin.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Hi,
I have interesting question that stops me now.
Suppose I have 2 functions

1. preparestate
2. doajob

first allocates some state using
MemoryContextAlloc(TopTransactionContext)
or something, another function using that memory.

question is how I lookup that memory in second function doajob?

Of cause I can return a handle from first function, pointer and accept
that pointer in second function, but in this case I have to check
that pointer on validity and so on...

Is there any good practice ( some way to do so ) for that?

Thank you.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joe Conway 2003-06-30 23:22:52 Re: [HACKERS] Share state ( allocated memory ) across two C functions...
Previous Message Patrick Hatcher 2003-06-30 22:03:52 Pg_Dumpall error?

Browse pgsql-hackers by date

  From Date Subject
Next Message Joe Conway 2003-06-30 23:22:52 Re: [HACKERS] Share state ( allocated memory ) across two C functions...
Previous Message elein 2003-06-30 21:59:30 Re: PlPython