Skip site navigation (1) Skip section navigation (2)

libpq block allocated before my malloc handler inits?

From: rob <rob(at)robstoddard(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: libpq block allocated before my malloc handler inits?
Date: 2008-06-26 17:20:58
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
I am trying to build a small program with libpq as the interface to a 
Postgre database.  I am using the most current version.  My program uses 
malloc and free hooks to manage memory without having to request memory 
from the system all the time.  I expected that the init function 
(__malloc_initialize_hook)  would run before anything else, but after 
opening a number of connections to the database with PQconnectdb, my 
program blows up because of a free which refers to a block of memory 
that wasn't allocated using my malloc function.  My program runs without 
a hitch if I comment out the PQconnectdb function calls.

Is there something that runs before my malloc init function in libpq?  
If there is, is there a way to make it happen afterwards?  Is there a 
library interface which doesn't have hidden init functions?

Please reply to me directly as well as CCing to the list; I haven't 
subscribed to the list.

Thank you very much for your input,

Rob Stoddard


pgsql-general by date

Next:From: Brandon MetcalfDate: 2008-06-26 17:24:51
Subject: Re: new RETURNING clause and
Previous:From: Tom LaneDate: 2008-06-26 17:18:46
Subject: Re: new RETURNING clause and

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group