From: Big H <haystacks@bigfoot.com>
Subject: Re: Strange pointer addresses causing SEGV
Date: Sat, 02 Feb 2002 20:14:38 +0000 [thread overview]
Message-ID: <gqho5u81e2rk46mnkiskje8qunuefpgim8@4ax.com> (raw)
In-Reply-To: 5pX68.2722$3E5.240464@newsread2.prod.itd.earthlink.net
On Sat, 02 Feb 2002 19:49:21 GMT, "Paul Pluzhnikov"
<ppluzhnikov@earthlink.net> wrote:
>"Big H" <haystacks@bigfoot.com> wrote in message
>news:bnbn5u8ja8v7inn5de524k9fb1v4k6tldg@4ax.com...
>
>> However, I have made some progress and the problem seems to be related
>> to the static functions being called containing a ostrstream. The
>> functions are stored in a collection of pointers to functions.
>>
>
>Now, this sounds interesting, as I have a totally
>different (and non-threaded) program, in which I have
>isolated stack corruption to the exact same ostream
>constructor:
>
>> This was the original:
>>
>> static int
>> f_readData1 ( DbObject* in_object, CORBA::any& out_value )
>> {
>> char buf[MAX_BUF_SIZE];
>>
>> ostrstream ( buf, sizeof(buf) );
>>
>
>In my case changing to:
>
> char buf[MAX_BUF_SIZE+40];
> ostrstream(buf, MAX_BUF_SIZE];
>
>made the corruption go away.
>
>> static int
>> f_readData1 ( DbObject* in_object, CORBA::any& out_value )
>> {
>> auto_ptr<char*> buf ( new char[MAX_BUF_SIZE] );
>> ostrstream ( buf.get(), MAX_BUF_SIZE );
>...
>> This works correctly!!!
>>
>
>It probably doesn't "work correctly", it's just that
>the problem has moved elsewhere (and corrupted memory
>happens to be unimportant). You are compiling with 'cxx',
>aren't you?
Yes, was compiling with cxx v6.1-029. I read release notes for latest
version and that mentioned about problems with streams and thread so i
loaded it. Then spent 6 hours rebuilding the code! using 6.3a compiler
and got exactly the same result - SEGV.
argh......
>
>I am still trying to determine root cause (my program is
>also big, and smaller examples do not demonstrate the problem).
This too is a large program, when running it is in excess of 500mb.
>
>[I do not think this has anything to do with threads,
>Follow-up set to comp.unix.tru64]
>
As far as i can see it seems thread related as this code has been
running on several production systems for several years. This problem
only arises when I'm trying to access the data from a separate thread.
Also, the fact that the address of the arguments seems to be shifted
is strange, as it only does this for the static functions containing
the ostream constructor.
I certainly can't afford for the problem to be moved!
Which version of the compiler were you using?
Cheers,
Big H
next parent reply other threads:[~2002-02-02 20:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <943a15cc.0201290533.598aa1a7@posting.google.com>
[not found] ` <bnbn5u8ja8v7inn5de524k9fb1v4k6tldg@4ax.com>
[not found] ` <5pX68.2722$3E5.240464@newsread2.prod.itd.earthlink.net>
2002-02-02 20:14 ` Big H [this message]
2002-02-02 22:39 ` Strange pointer addresses causing SEGV Paul Pluzhnikov
2002-02-02 23:14 ` Big H
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox