pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: markw <markw@mohawksoft.com>
To: Hiroshi Inoue <Inoue@tpf.co.jp>
Cc: pgsql-odbc@postgresql.org
Subject: Re: Threading crash using ODBC
Date: Mon, 18 Nov 2002 10:19:48 -0500
Message-ID: <3DD90514.6060704@mohawksoft.com> (raw)
References: <3DD51F26.7050201@mohawksoft.com>
	<3DD5BEF7.4F734DA4@tpf.co.jp>
	<3DD5C7C8.5090500@mohawksoft.com>
	<3DD5D250.AFF7D4C@tpf.co.jp>
	<3DD631C0.5090108@mohawksoft.com>
	<3DD864C9.D0865217@tpf.co.jp>



Hiroshi Inoue wrote:

>markw wrote:
>  
>
>>Hiroshi Inoue wrote:
>>
>>    
>>
>>>markw wrote:
>>>      
>>>
>
>[snip]
>
>  
>
>>>>Actually, I tracked it down. It may be something that you are
>>>>interested in, I had my stack set to 64K, when I bumped it up to 256K,
>>>>the problem went away.
>>>>
>>>>Both the unixODBC and PostgreSQL drivers are similar, or at least have
>>>>a similar origin. The stack utilization deserve at least a little
>>>>scrutiny.
>>>>
>>>>
>>>>        
>>>>
>>>I've improved a little about the stack utilization of
>>>our ODBC driver and some applications could work with
>>>the improvement though I'm not sure if it can work with
>>>your application.
>>>
>>>
>>>      
>>>
>>well, I'm flexable, and I'm sure it would be helpful to many other
>>developers, what is a good estimate for thread stack size?
>>    
>>
>
>Though the unixODBC and PostgreSQL drivers have a similar origin,
>they are pretty different now. As for stack utilization, I removed
>MAX_MESSAGE_LEN(65536) byte buffers completely and so most
>applications may be able to work with 64K stack size.
>  
>
That's great news. Did you use malloc or alloca?

The reason I ask, I know alloca is "discouraged" and not "posix" but it
is supported on a lot of platforms (Including Windows as _alloca), and
if wrapped in a macro, should be extreamly portable. Given a choice, I'd
rather use stack memory for short term allocations and just beef up the
stack, than use malloc.

For server programs that expect to be running long term, think months or
years, heap fragmentation is a serious issue. Stack based allocations
are a good way to avoid this problem.

>  
>





view thread (8+ messages)  latest in thread

Message-ID: <3DD90514.6060704@mohawksoft.com>
Permalink:  ../3DD90514.6060704@mohawksoft.com/
Also on:    postgresql.org/message-id/3DD90514.6060704@mohawksoft.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: markw@mohawksoft.com, Inoue@tpf.co.jp
  Subject: Re: Threading crash using ODBC
  In-Reply-To: <3DD90514.6060704@mohawksoft.com>
  References: <3DD51F26.7050201@mohawksoft.com> <3DD5BEF7.4F734DA4@tpf.co.jp> <3DD5C7C8.5090500@mohawksoft.com> <3DD5D250.AFF7D4C@tpf.co.jp> <3DD631C0.5090108@mohawksoft.com> <3DD864C9.D0865217@tpf.co.jp> <3DD90514.6060704@mohawksoft.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox