Re: PQescapeBytea on Win32

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Key88 SF <key88sf(at)hotmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: PQescapeBytea on Win32
Date: 2003-03-18 05:48:07
Message-ID: 200303180548.h2I5m7e09803@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


All apps need the multi-threaded option, I think.

---------------------------------------------------------------------------

Key88 SF wrote:
>
> Actually this isn't even working for me. I just compiled the libpq dll with
> /MT (multithreaded), and I still get corruption in my app. I even tried
> libpq compiled with multithreaded-debug (/MTd), which my app is using now,
> and still same problem. I think a separate function would be great to have.
>
>
> >From: "Key88 SF" <key88sf(at)hotmail(dot)com>
> >To: pgman(at)candle(dot)pha(dot)pa(dot)us
> >CC: pgsql-hackers(at)postgresql(dot)org
> >Subject: Re: [HACKERS] PQescapeBytea on Win32
> >Date: Tue, 18 Mar 2003 05:07:29 +0000
> >MIME-Version: 1.0
> >X-Originating-IP: [67.118.28.93]
> >Received: from relay1.pgsql.com ([64.49.215.129]) by
> >mc5-f2.law1.hotmail.com with Microsoft SMTPSVC(5.0.2195.5600); Mon, 17 Mar
> >2003 21:07:40 -0800
> >Received: from postgresql.org (postgresql.org [64.49.215.8])by
> >relay1.pgsql.com (Postfix) with ESMTPid DB3426F73A1; Tue, 18 Mar 2003
> >00:07:38 -0500 (EST)
> >Received: from hotmail.com (f127.law9.hotmail.com [64.4.9.127])by
> >postgresql.org (Postfix) with ESMTP id 0247A474E4Ffor
> ><pgsql-hackers(at)postgresql(dot)org>; Tue, 18 Mar 2003 00:07:25 -0500 (EST)
> >Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC;
> >Mon, 17 Mar 2003 21:07:30 -0800
> >Received: from 67.118.28.93 by lw9fd.law9.hotmail.msn.com with HTTP;Tue, 18
> >Mar 2003 05:07:29 GMT
> >X-Message-Info: JGTYoYF78jEHjJx36Oi8+Q1OJDRSDidP
> >X-Original-To: pgsql-hackers(at)postgresql(dot)org
> >Message-ID: <F127CGlbZvFqV2mEIkL00001ff2(at)hotmail(dot)com>
> >X-OriginalArrivalTime: 18 Mar 2003 05:07:30.0217 (UTC)
> >FILETIME=[46BFF190:01C2ED0C]
> >Precedence: bulk
> >Sender: pgsql-hackers-owner(at)postgresql(dot)org
> >Return-Path: pgsql-hackers-owner+M36954(at)postgresql(dot)org
> >
> >I suppose that is ok. But the default compiler flags in the provided
> >makefile for libpq is non-multithreaded. That should at least be fixed I
> >would think.
> >
> >If it's not a big deal for you, I would say that in the name of safety for
> >those people who don't look closely at these things, it would be better to
> >have the callback function to delete the memory and not have to assume
> >libpq is built with the correct c-runtimes...
> >
> >-Dave
> >
> >
> >
> >
> >>From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
> >>To: Key88 SF <key88sf(at)hotmail(dot)com>
> >>CC: pgsql-hackers(at)postgresql(dot)org
> >>Subject: Re: [HACKERS] PQescapeBytea on Win32
> >>Date: Tue, 18 Mar 2003 00:01:38 -0500 (EST)
> >>MIME-Version: 1.0
> >>Received: from candle.pha.pa.us ([207.106.42.251]) by
> >>mc6-f24.law1.hotmail.com with Microsoft SMTPSVC(5.0.2195.5600); Mon, 17
> >>Mar 2003 21:01:44 -0800
> >>Received: (from pgman(at)localhost)by candle.pha.pa.us (8.11.6/8.10.1) id
> >>h2I51cW03568;Tue, 18 Mar 2003 00:01:38 -0500 (EST)
> >>X-Message-Info: JGTYoYF78jEHjJx36Oi8+Q1OJDRSDidP
> >>Message-Id: <200303180501(dot)h2I51cW03568(at)candle(dot)pha(dot)pa(dot)us>
> >>In-Reply-To: <F159qHSgNZuILS94O9J00042a23(at)hotmail(dot)com>
> >>X-Mailer: ELM [version 2.4ME+ PL99 (25)]
> >>Return-Path: pgman(at)candle(dot)pha(dot)pa(dot)us
> >>X-OriginalArrivalTime: 18 Mar 2003 05:01:44.0926 (UTC)
> >>FILETIME=[78F0B7E0:01C2ED0B]
> >>
> >>
> >>Yes, I am aware of that limitation. If you link libpq as a
> >>Multithreaded DLL, it will not link libc into each DLL, but have only
> >>one libc that can free from anywhere.
> >>
> >>Is that acceptable or do we need a Win32 specific memory free function?
> >>
> >>---------------------------------------------------------------------------
> >>
> >>Key88 SF wrote:
> >> >
> >> > Hi - there is a problem with PQescapeBytea for Win32. Since libpq is a
> >>DLL,
> >> > all memory allocated from within the DLL needs to be freed from within
> >>the
> >> > dll.
> >> >
> >> > PQescapeBytea allocates memory, but there is no function call back into
> >>the
> >> > DLL to free this memory. This causes heap corruption when the main
> >>program
> >> > tries to free the memory itself. The alternative is to just leak the
> >>memory
> >> > and never free it. Also bad....
> >> >
> >> > -Dave Brown
> >> > key88sf(at)hotmail(dot)com
> >> >
> >> >
> >> > _________________________________________________________________
> >> > Add photos to your messages with MSN 8. Get 2 months FREE*.
> >> > http://join.msn.com/?page=features/featuredemail
> >> >
> >> >
> >> > ---------------------------(end of
> >>broadcast)---------------------------
> >> > TIP 3: if posting/reading through Usenet, please send an appropriate
> >> > subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> >> > message can get through to the mailing list cleanly
> >> >
> >>
> >>--
> >> Bruce Momjian | http://candle.pha.pa.us
> >> pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
> >> + If your life is a hard drive, | 13 Roberts Road
> >> + Christ can be your backup. | Newtown Square, Pennsylvania
> >>19073
> >
> >
> >_________________________________________________________________
> >Add photos to your e-mail with MSN 8. Get 2 months FREE*.
> >http://join.msn.com/?page=features/featuredemail
> >
> >
> >---------------------------(end of broadcast)---------------------------
> >TIP 2: you can get off all lists at once with the unregister command
> > (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>
>
> _________________________________________________________________
> Protect your PC - get McAfee.com VirusScan Online
> http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
>
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2003-03-18 05:48:54 Re: [HACKERS] SQL99 ARRAY support proposal
Previous Message Joe Conway 2003-03-18 05:41:26 Re: PQescapeBytea on Win32