Re: [HACKERS] Memory problem? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] Memory problem?
Date
Msg-id 22580.929454935@sss.pgh.pa.us
Whole thread Raw
In response to Memory problem?  ("Patrick Welche" <prlw1@newn.cam.ac.uk>)
Responses Re: [HACKERS] Memory problem?
List pgsql-hackers
"Patrick Welche" <prlw1@newn.cam.ac.uk> writes:
> I am having trouble with PQclear causing a segmentation fault, and I don't
> really know where to look.

Not at PQclear(); almost surely, the bug lies elsewhere.  The most
likely bets are (a) that PQclear is being called twice for the same
PGresult (although this looks unlikely with the current libpq++,
since it doesn't give the calling app direct access to the PGresult),
or (b) that some random other bit of code is clobbering memory that
doesn't belong to it.  When you make a mistake like writing a little
bit past the end of a malloc'd piece of memory, the usual symptom is
coredumps in later malloc or free operations, because what you've
clobbered is malloc's memory management data structures.

Unfortunately that means the bug might be almost anywhere else in
your app :-(.  Good luck...
        regards, tom lane


pgsql-hackers by date:

Previous
From: Wayne
Date:
Subject: off-topic: pgaccess?
Next
From: Peter Mount
Date:
Subject: RE: [HACKERS] off-topic: pgaccess?