Re: c extension

From: Joe Conway <mail(at)joeconway(dot)com>
To: Kjetil Haaland <kjetil(dot)haaland(at)student(dot)uib(dot)no>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: c extension
Date: 2004-11-03 14:58:15
Message-ID: 4188F207.3030702@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Kjetil Haaland wrote:
> I am writing a c extension function to my postgres database and in this i am
> trying to allocate memory space for a table of char. When i try to call a
> function that returns a value from this table postgres crashes. It works fine
> running it as c code. I have added part of the code and hope that someone can
> help me.

> scoreChar = (char*)palloc(20*sizeof(char));

It doesn't look like that palloc is done in a sufficiently long-lived
memory context. Read up on them in src/backend/utils/mmgr/README.

Joe

In response to

  • c extension at 2004-11-03 09:29:17 from Kjetil Haaland

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Raphael Bauduin 2004-11-03 15:36:54 Re: building a row with a plpgsql function
Previous Message Joe Conway 2004-11-03 14:49:06 Re: building a row with a plpgsql function