From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: ffc1e,c324b43dfcb845cd X-Google-Attributes: gidffc1e,public X-Google-Thread: fa528,cdbab35922e62791,start X-Google-Attributes: gidfa528,public X-Google-ArrivalTime: 2002-02-02 12:17:20 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!lon1-news.nildram.net!peernews!peer.cwci.net!news5-gui.server.ntli.net!ntli.net!news6-win.server.ntlworld.com.POSTED!not-for-mail From: Big H Newsgroups: comp.unix.tru64,comp.programming.threads Subject: Re: Strange pointer addresses causing SEGV Message-ID: References: <943a15cc.0201290533.598aa1a7@posting.google.com> <5pX68.2722$3E5.240464@newsread2.prod.itd.earthlink.net> X-Newsreader: Forte Agent 1.9/32.560 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Sat, 02 Feb 2002 20:14:38 +0000 NNTP-Posting-Host: 80.1.7.80 X-Complaints-To: abuse@virgin.net X-Trace: news6-win.server.ntlworld.com 1012680883 80.1.7.80 (Sat, 02 Feb 2002 20:14:43 GMT) NNTP-Posting-Date: Sat, 02 Feb 2002 20:14:43 GMT Organization: Virgin Net Usenet Service Xref: archiver1.google.com comp.unix.tru64:6690 comp.programming.threads:8333 On Sat, 02 Feb 2002 19:49:21 GMT, "Paul Pluzhnikov" wrote: >"Big H" 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 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