This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: static vs. shared linking


On 25/03/2015 16:59, Warren Young wrote:
On Mar 25, 2015, at 3:04 AM, Corinna Vinschen<corinna-cygwin@cygwin.com>  wrote:

And this is where it comes from.  It's a call to

    void basic_string<_CharT, _Traits, _Alloc>::reserve(size_type __res)
David, what happens if you say

     wtext.reserve(1);

inside runTests() before the call to crash()?

If that makes the symptom disappear, I wonder if thereâs some problem with a Cygwin *.exe owning a std::string that gets resized by a Cygwin *.dll.  If so, that probably*is*  a memory ownership coordination problem that affects Cygwin proper.

Thank you for taking the time to look at this. You are quite correct. When I reserve() space on the string in runTests() then the problem goes away.

In order to test your hypothesis about memory ownership, I'll create a test that malloc(3)s some memory in the .exe and free(3)s it in a shared library; Corinna showed that the crash was coming from an abort() in free(). However, I can't believe it's that simple - you'd think there would be dozens of programmes crashing for this reason.

Iâve run both versions under valgrind on a Linux box here, and they can find no fault with your code.

Thanks. Obviously, when coming across problems like this, my first thought is that I've managed to do something silly. But if neither you, me nor Corinna can spot an obvious blunder then that opens the possibility that there's something fruity going on.

On manual inspection, I, too find it to be perfectly cromulent.

Personally, I was thoroughly discombobulated.

Dave.



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]