Return-Path: pg_adm@postgres.berkeley.edu
Received: by postgres.Berkeley.EDU (5.61/1.29)
	id AA26329; Thu, 14 Nov 91 18:52:48 -0800
Date: Thu, 14 Nov 91 18:52:48 -0800
Message-Id: <9111150252.AA26329@postgres.Berkeley.EDU>
From: Walid Aref <aref@alv.umd.edu>
Subject: C++ and Postgres
To: postgres@postgres.berkeley.edu
Sender: pg_adm@postgres.berkeley.edu
Cc: aref@alv.umd.edu

I am using POSTGRES and gnu C++ running on a SPARC I station.
I am facing the following memory allocation problem:

I found somewhere in POSTGRES files
the following comment (actually when defining C functions for abstract data
types):

        /*
         * The Postgres memory  manager "palloc" must be used for all
         * space allocation. Do not  use "malloc".
         */

This is fine.
However, when using the class String (or possibly other C++ classes)
from the gnu C++ class library with POSTGRES, the class String internally
calls malloc/free/realloc. 
The whole system (postgres, my application, or both) crashes and memory gets 
corrupted. (segmentation fault, core dumped, etc.) when we make extensive use 
of strings interleaved with POSTGRES commands.
Did anyone face a similar problem  when using gnu C++ class library 
extensively intermixed with POSTGRES library calls?

Is this a real problem or are we doing something terribly wrong elsewhere?
or both :-)?

Thanks in advance.
walid

PS: The size of our executable code is around 4 Mega bytes. I am not sure
    if this is a useful piece of information, but just in case.
