• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Xcode 3.2.1 Debug target malloc problem with Boost Libraries 1.41
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Xcode 3.2.1 Debug target malloc problem with Boost Libraries 1.41


  • Subject: Xcode 3.2.1 Debug target malloc problem with Boost Libraries 1.41
  • From: Daniel Lord <email@hidden>
  • Date: Sat, 23 Jan 2010 12:33:02 -0800

When I use Xcode compile (with a Debug target) a simple Reg Ex example from the Boost getting started page and run a simple test, the execution aborts with the following message:

cat Test_Letter.txt | BoostRegexTest

BoostRegexTest(33124) malloc: *** error for object 0x100019560: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Test.sh: line 9: 33123 Done                    cat Test_Letter.txt
     33124 Abort trap              | build/Debug/BoostRegexTest

And if I use an Xcode  Release target it works as expected.

cat Test_Letter.txt | BoostRegexTest
Will Success Spoil Rock Hunter?

I set the breakpoint for malloc_error_break and unfortunately I plow into assembly with no bearings to allow me to follow the execution--its over my head without a lot of study on the particulars of Xcode Debugging std::string construction, initialization, and destruction so I thought I'd ask here first. The stack trace shows appending a character, a string being reserved for addition capacity,  and then seemingly being freed before any assignment which might explain the message perhaps (or something close to that)

#0 0x7fff82a2d951 in malloc_error_break
#1 0x7fff82957143 in free
#2 0x7fff84eed1e8 in std::string::reserve
#3 0x7fff84eed243 in std::string::push_back
#4 0x7fff84ed62b5 in std::getline<char, std::char_traits<char>, std::allocator<char> >
#5 0x100005213 in std::getline<char, std::char_traits<char>, std::allocator<char> > at basic_string.h:2451
#6 0x100001b03 in main at main.cpp:12

So Xcode is adding a call to free() during a Debug compilation or linking that is giving Boost fits but i have no idea what it might be nor why though it very likely has something to do with debugging

I did  search of this mailing list on "Boost", "Xcode", and "malloc" and found nothing which might mean few on this lsit are using Boost, it's something trivial and obvious except to me, or I didn't search thoroughly enough. I have seen some claims of this problem elsewhere in the net regarding other Boost modules--Unit test in particular.

So, essentially, I cannot use the Xcode debugger with any Debug target using the Boost Libraries and that's pretty limiting for the quantitative finance work I am doing. Anyone have any hints to help me narrow it down?

ATTACHMENTS
--------------------------------------
Here is the simple program:
#include <boost/regex.hpp>
#include <iostream>
#include <string>

int main()
{
    std::string line;
    boost::regex pat( "^Subject: (Re: |Aw: )*(.*)" );


    while (std::cin)
    {
        std::getline(std::cin, line);
        boost::smatch matches;
        if (boost::regex_match(line, matches, pat))
            std::cout << matches[2] << std::endl;
    }
}



My environment
----------------------
Xcode 3.2.1
OS X 10.6.2
Boost 1.41.0 built for X86_64 and i386 in both static and dynamic libs by Macports configured with +universal variant and installed in /opt/local

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Decoder problem
  • Next by Date: C++: what could cause dynamic_cast<> to fail?
  • Previous by thread: Decoder problem
  • Next by thread: C++: what could cause dynamic_cast<> to fail?
  • Index(es):
    • Date
    • Thread