Serious Issue With std::vector
Serious Issue With std::vector
- Subject: Serious Issue With std::vector
- From: Adin Hunter Baber <email@hidden>
- Date: Sun, 4 Dec 2005 16:54:39 -0600
Sorry for the cross post, but I thought that this post was germane to
both groups.
I ran into an error while trying to use std::vectors in my carbon
project. Apparently, something is happening when the vector tries to
allocate new memory for a push_back() call.
The gdb window that pops us says:
"Unable to disassemble __new_handler."
The stack trace shows this:
#0 0xffff8a4c in __new_handler
#1 0x000051f8 in std::__copy<true,
std::random_access_iterator_tag>::copy<int> at stl_algobase.h:300
#2 0x00006098 in std::__copy_aux<int*, int*> at stl_algobase.h:317
#3 0x0000666c in std::__copy_normal<true,
true>::copy_n<__gnu_cxx::__normal_iterator<int*, std::vector<int,
std::allocator<int> > >, __gnu_cxx::__normal_iterator<int*,
std::vector<int, std::allocator<int> > > > at stl_algobase.h:354
#4 0x00006704 in std::copy<__gnu_cxx::__normal_iterator<int*,
std::vector<int, std::allocator<int> > >,
__gnu_cxx::__normal_iterator<int*, std::vector<int,
std::allocator<int> > > > at stl_algobase.h:387
#5 0x00006780 in
std::__uninitialized_copy_aux<__gnu_cxx::__normal_iterator<int*,
std::vector<int, std::allocator<int> > >,
__gnu_cxx::__normal_iterator<int*, std::vector<int,
std::allocator<int> > > > at stl_uninitialized.h:74
#6 0x00006800 in
std::uninitialized_copy<__gnu_cxx::__normal_iterator<int*,
std::vector<int, std::allocator<int> > >,
__gnu_cxx::__normal_iterator<int*, std::vector<int,
std::allocator<int> > > > at stl_uninitialized.h:113
#7 0x0000687c in
std::__uninitialized_copy_a<__gnu_cxx::__normal_iterator<int*,
std::vector<int, std::allocator<int> > >,
__gnu_cxx::__normal_iterator<int*, std::vector<int,
std::allocator<int> > >, int> at stl_uninitialized.h:254
#8 0x00006acc in std::vector<int, std::allocator<int>
>::_M_insert_aux at vector.tcc:279
#9 0x00006d38 in std::vector<int, std::allocator<int> >::push_back at
stl_vector.h:610
#10 0x00006d94 in FileListElement::push_child at FileList.hpp:47
#11 0x0000260c in loadRootFolder at main.cpp:30
#12 0x000028dc in main at main.cpp:16
The project and minimized code can be found here http://
www.adinhunterbaber.com/downloads/FileList.tar.gz
Every time I run this test app, it fails with the above error. I am
running Xcode 2.2 on a Powerbook 12" 1.5Ghz / 768 Meg.
I have seen two other mentions of problems with the STL on the
mailing lists. And I am wondering if there is some serious glitch in
the STL implementation or gcc.
Could someone else please download the above project, and see if it
also fails for you?
Notes:
Initially the code in loadRootFolder() did not have the strings
created before passing them into calls to push_file(). However, I
found that when I tried to use the implicit cstr->string conversion,
the code would also fail when trying to allocate memory for the
string. This causes me to believe the error may be in the
std::allocator.
I've been using my own C++ classes extensively. These classes don't
use std::allocator, and thus have not exhibited any such problems. I
even implemented my own vector class, which doesn't use
std::allocator, and now my application is working as it should.
Adin Hunter Baber
email@hidden
_______________________________________________
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