Boost logo

Boost Users :

Subject: Re: [Boost-users] [Iostreams] Segmentation fault when stream is flushed or closed
From: Steven Maenhout (Steven.Maenhout_at_[hidden])
Date: 2013-11-26 03:41:16


On 11/26/2013 08:55 AM, Slava wrote:

> Generated assembly for Test::Test() and Test::Test(const
> std::stringstream& logStream) is identical up to saving the parameter
> passed in rsi/esi in stack (in debug version). When I change the
> constructor parameter to for example int, the crash occurs as well. So I
> would conclude, the crash is caused by dereferencing destroyed local
> variable. It just does not show itself in case of no parameter because
> the stack memory conflict occasionally does not happen under these
> circumstances and valgrind is not able to detect it properly.

that makes sense I suppose. You are definitely right that maintaining
the sink streams solves my problems so I should not further complicate
matters by finding examples that 'appear' to work with temporaries.

thank you kindly for your help Slava,

Steven


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net