Re: Generating Huge String?

From: Steffen Nielsen <styf(at)cs(dot)auc(dot)dk>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Generating Huge String?
Date: 2002-04-23 20:17:59
Message-ID: 1019593079.3cc5c177c1b36@www.cs.auc.dk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi!

I checked out the StringInfo functions, they are basicly the same as the
Chunks functions I use, but I'll use the others instead even thought I don't
think they will help me on my problem. But anyway, I've checked out the malloc
and realloc function, and believe that they won't allow allocation into an
allready occopied memory area (at least on freebsd).

But if not, maybe I should create a new Chunk (malloc again, and copy; But
that would probably lead to heavy fragmentation of the memory) if realloc
can't allocate more continuos memory space?

Sorry if these question seem trivially, I'm a C newbie :-)

/Steffen Nielsen

Quoting Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:

> Steffen Nielsen <styf(at)cs(dot)auc(dot)dk> writes:
> > I have tried using chunks technique when creating huge string for a stored
>
> > procedure (C code). I work like charm for small string, but when i create
>
> > large strings i get a "server closed the connection unexpectedly" :-(
>
> Look for bugs in your code ;-). I'd bet it's scribbling on memory that
> doesn't belong to it.
>
> > And how does one normally handle Large strings in postgres?
>
> The StringInfo functions are moderately convenient in most cases.
>
> regards, tom lane
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2002-04-23 20:26:18 Re: Coster/planner and edge cases...
Previous Message Hannu Krosing 2002-04-23 18:59:17 Re: Documentation on page files