Re: C Function Memory Management

From: Martin French <Martin(dot)French(at)romaxtech(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org, pgsql-general-owner(at)postgresql(dot)org
Subject: Re: C Function Memory Management
Date: 2012-12-12 15:37:55
Message-ID: OF1966B1DE.9C8C2699-ON80257AD2.0055AC07-80257AD2.0055DEA8@romaxtech.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>
> One thing to know about it is that repalloc re-sizes the given chunk
> while keeping it in the same memory context it was originally allocated
> in (ie, CurrentMemoryContext doesn't matter). This may not matter much
> if you're only dealing with allocations that just live as long as the
> current function call --- but if you're trying to preserve data across
> calls, it's critical to know.
>
> regards, tom lane

Thanks for this Tom, I'll keep that in mind for future functions.

In this particular implementation, it's not necessary to preserve the data
once the function is complete.

So out of curiosity, what would be your approach for data preservation
cross call?

Cheers

Martin
=============================================

Romax Technology Limited
Rutherford House
Nottingham Science & Technology Park
Nottingham,
NG7 2PZ
England

Telephone numbers:
+44 (0)115 951 88 00 (main)

For other office locations see:
http://www.romaxtech.com/Contact
=================================
===============
E-mail: info(at)romaxtech(dot)com
Website: www.romaxtech.com
=================================

================
Confidentiality Statement
This transmission is for the addressee only and contains information that
is confidential and privileged.
Unless you are the named addressee, or authorised to receive it on behalf
of the addressee
you may not copy or use it, or disclose it to anyone else.
If you have received this transmission in error please delete from your
system and contact the sender. Thank you for your cooperation.
=================================================

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Justin Arnold 2012-12-12 15:46:16 Columns defined not matching pg_attibute
Previous Message Tom Lane 2012-12-12 15:29:01 Re: C Function Memory Management