Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad Alloc #41

Open
ahmed-shafik opened this issue May 1, 2014 · 1 comment
Open

Bad Alloc #41

ahmed-shafik opened this issue May 1, 2014 · 1 comment

Comments

@ahmed-shafik
Copy link

Dears,

I get the below error while creating a new rank object because of adding new bankstates (nextWrite_H & nextRead_H) in BankState.h and BankState.cpp. Do you know why?

class BankState
{
ostream &dramsim_log;
public:
//Fields
CurrentBankState currentBankState;
unsigned openRowAddress;
uint64_t nextRead;
uint64_t nextWrite;
uint64_t nextRead_H;
uint64_t nextWrite_H;
uint64_t nextActivate;
uint64_t nextPrecharge;
uint64_t nextPowerUp;

BusPacketType lastCommand;
unsigned stateChangeCountdown;

//Functions
BankState(ostream &dramsim_log_);
void print();

};
}

//All banks start precharged
BankState::BankState(ostream &dramsim_log_):
dramsim_log(dramsim_log_),
currentBankState(Idle),
openRowAddress(0),
nextRead(0),
nextRead_H(0),
nextWrite(0),
nextWrite_H(0),
nextActivate(0),
nextPrecharge(0),
nextPowerUp(0),
lastCommand(READ),
stateChangeCountdown(0)
{}

Rank *r = new Rank(dramsim_log);
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
Aborted (core dumped)

@ahmed-shafik
Copy link
Author

I used gdb and get below (_n=18446744073709547290) after statement
return size_type(this->_M_impl._M_finish - this->_M_impl._M_start)
although in normal state the (n=2048). Do you know why ?
DRAMSim::Rank::Rank (this=0x6534e0, dramsim_log
=...) at Rank.cpp:48
48 bankStates(NUM_BANKS, BankState(dramsim_log
))
(gdb)
DRAMSim::SimulatorObject::SimulatorObject (this=0x6534e0) at SimulatorObject.h:50
50 class SimulatorObject
(gdb)
std::vector<DRAMSim::BusPacket*, std::allocatorDRAMSim::BusPacket* >::vector (this=0x653538) at /usr/include/c++/4.7/bits/stl_vector.h:247
247 : _Base() { }
(gdb)
std::_Vector_base<DRAMSim::BusPacket*, std::allocatorDRAMSim::BusPacket* >::_Vector_base (this=0x653538) at /usr/include/c++/4.7/bits/stl_vector.h:126
126 : _M_impl() { }
(gdb)
std::_Vector_base<DRAMSim::BusPacket*, std::allocatorDRAMSim::BusPacket* >::_Vector_impl::_Vector_impl (this=0x653538) at /usr/include/c++/4.7/bits/stl_vector.h:88
88 : _Tp_alloc_type(), _M_start(0), _M_finish(0), _M_end_of_storage(0)
(gdb)
std::allocatorDRAMSim::BusPacket*::allocator (this=0x653538) at /usr/include/c++/4.7/bits/allocator.h:104
104 allocator() throw() { }
(gdb)
__gnu_cxx::new_allocatorDRAMSim::BusPacket*::new_allocator (this=0x653538) at /usr/include/c++/4.7/ext/new_allocator.h:69
69 new_allocator() _GLIBCXX_USE_NOEXCEPT { }
(gdb)
std::_Vector_base<DRAMSim::BusPacket*, std::allocatorDRAMSim::BusPacket* >::_Vector_impl::_Vector_impl (this=0x653538) at /usr/include/c++/4.7/bits/stl_vector.h:89
89 { }
(gdb)
std::allocator::allocator (this=0x7fffffffdf00) at /usr/include/c++/4.7/bits/allocator.h:104
104 allocator() throw() { }
(gdb)
__gnu_cxx::new_allocator::new_allocator (this=0x7fffffffdf00) at /usr/include/c++/4.7/ext/new_allocator.h:69
69 new_allocator() _GLIBCXX_USE_NOEXCEPT { }
(gdb)
std::vector<unsigned int, std::allocator >::vector (this=0x653550, __n=0, __value=@0x7fffffffdefc: 0, __a=...)
at /usr/include/c++/4.7/bits/stl_vector.h:294
294 : _Base(__n, __a)
(gdb)
std::_Vector_base<unsigned int, std::allocator >::_Vector_base (this=0x653550, __n=0, __a=...) at /usr/include/c++/4.7/bits/stl_vector.h:136
136 : _M_impl(__a)
(gdb)
std::_Vector_base<unsigned int, std::allocator >::_Vector_impl::_Vector_impl (this=0x653550, __a=...) at /usr/include/c++/4.7/bits/stl_vector.h:92
92 : _Tp_alloc_type(__a), _M_start(0), _M_finish(0), _M_end_of_storage(0)
(gdb)
std::allocator::allocator (this=0x653550, __a=...) at /usr/include/c++/4.7/bits/allocator.h:107
107 : __glibcxx_base_allocator<_Tp>(__a) { }
(gdb)
__gnu_cxx::new_allocator::new_allocator (this=0x653550) at /usr/include/c++/4.7/ext/new_allocator.h:71
71 new_allocator(const new_allocator&) _GLIBCXX_USE_NOEXCEPT { }
(gdb)
std::_Vector_base<unsigned int, std::allocator >::_Vector_impl::_Vector_impl (this=0x653550, __a=...) at /usr/include/c++/4.7/bits/stl_vector.h:93
93 { }
(gdb)
std::_Vector_base<unsigned int, std::allocator >::_Vector_base (this=0x653550, __n=0, __a=...) at /usr/include/c++/4.7/bits/stl_vector.h:137
137 { _M_create_storage(__n); } //create storage for __n=0 banks
(gdb)
std::_Vector_base<unsigned int, std::allocator >::_M_create_storage (this=0x653550, __n=0) at /usr/include/c++/4.7/bits/stl_vector.h:182
182 this->_M_impl._M_start = this->_M_allocate(__n);
(gdb)
std::_Vector_base<unsigned int, std::allocator >::_M_allocate (this=0x653550, __n=0) at /usr/include/c++/4.7/bits/stl_vector.h:169
169 { return __n != 0 ? _M_impl.allocate(__n) : 0; }
(gdb)
std::_Vector_base<unsigned int, std::allocator >::_M_create_storage (this=0x653550, __n=0) at /usr/include/c++/4.7/bits/stl_vector.h:183
183 this->_M_impl._M_finish = this->_M_impl._M_start;
(gdb)
184 this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n;
(gdb)
185 } //till now nothing sholud be created as _M_finish=_M_start = zero
(gdb)
std::vector<unsigned int, std::allocator >::vector (this=0x653550, __n=0, __value=@0x7fffffffdefc: 0, __a=...)
at /usr/include/c++/4.7/bits/stl_vector.h:295
295 { _M_fill_initialize(__n, __value); }
(gdb)
std::vector<unsigned int, std::allocator >::_M_fill_initialize (this=0x653550, __n=0, __value=@0x7fffffffdefc: 0)
at /usr/include/c++/4.7/bits/stl_vector.h:1181
1181 std::__uninitialized_fill_n_a(this->_M_impl._M_start, __n, __value, _M_get_Tp_allocator());
(gdb)
std::_Vector_base<unsigned int, std::allocator >::_M_get_Tp_allocator (this=0x653550) at /usr/include/c++/4.7/bits/stl_vector.h:115
115 { return _static_cast<Tp_alloc_type>(&this->_M_impl); }
(gdb)
std::__uninitialized_fill_n_a<unsigned int*, unsigned long, unsigned int, unsigned int> (__first=0x0, __n=0, __x=@0x7fffffffdefc: 0)
at /usr/include/c++/4.7/bits/stl_uninitialized.h:336
336 { std::uninitialized_fill_n(__first, __n, __x); } // __x = __value=@0x7fffffffdefc
(gdb)
std::uninitialized_fill_n<unsigned int*, unsigned long, unsigned int> (__first=0x0, __n=0, __x=@0x7fffffffdefc: 0) at /usr/include/c++/4.7/bits/stl_uninitialized.h:225
225 std::__uninitialized_fill_n<__is_trivial(_ValueType)>::
(gdb)
std::__uninitialized_fill_n::__uninit_fill_n<unsigned int*, unsigned long, unsigned int> (__first=0x0, __n=0, __x=@0x7fffffffdefc: 0)
at /usr/include/c++/4.7/bits/stl_uninitialized.h:206
206 { std::fill_n(__first, __n, __x); }
(gdb)
std::fill_n<unsigned int*, unsigned long, unsigned int> (__first=0x0, __n=0, __value=@0x7fffffffdefc: 0) at /usr/include/c++/4.7/bits/stl_algobase.h:780
780 return _OI(std::__fill_n_a(std::__niter_base(__first), __n, __value));
(gdb)
std::__niter_base<unsigned int*> (__it=0x0) at /usr/include/c++/4.7/bits/stl_algobase.h:272
272 { return std::_Niter_base<_Iterator>::_S_base(__it); } // __it is iterator and it points on __first
(gdb)
std::_Iter_base<unsigned int*, false>::_S_base (__it=0x0) at /usr/include/c++/4.7/bits/stl_iterator_base_types.h:214
214 { return __it; }
(gdb)
std::__fill_n_a<unsigned int*, unsigned long, unsigned int> (__first=0x0, __n=0, __value=@0x7fffffffdefc: 0) at /usr/include/c++/4.7/bits/stl_algobase.h:742
742 const _Tp __tmp = __value;
(gdb)
743 for (__decltype(__n + 0) __niter = __n; //for loop for __n
(gdb)
746 return __first;
(gdb)
747 }
(gdb)
std::fill_n<unsigned int*, unsigned long, unsigned int> (__first=0x0, __n=0, __value=@0x7fffffffdefc: 0) at /usr/include/c++/4.7/bits/stl_algobase.h:781
781 }
(gdb)
std::uninitialized_fill_n<unsigned int*, unsigned long, unsigned int> (__first=0x0, __n=0, __x=@0x7fffffffdefc: 0) at /usr/include/c++/4.7/bits/stl_uninitialized.h:227
227 }
(gdb)
std::vector<unsigned int, std::allocator >::_M_fill_initialize (this=0x653550, __n=0, __value=@0x7fffffffdefc: 0)
at /usr/include/c++/4.7/bits/stl_vector.h:1183
1183 this->_M_impl._M_finish = this->_M_impl._M_end_of_storage;
(gdb)
1184 }
(gdb)
std::allocator::~allocator (this=0x7fffffffdf00, __in_chrg=) at /usr/include/c++/4.7/bits/allocator.h:112
112 ~allocator() throw() { } // I think throw is called and finished the 1st allocation // jump by 4 --> 0x7fffffffdf00 - 0x7fffffffdefc = 4
(gdb)
__gnu_cxx::new_allocator::~new_allocator (this=0x7fffffffdf00, __in_chrg=) at /usr/include/c++/4.7/ext/new_allocator.h:76
76 ~new_allocator() _GLIBCXX_USE_NOEXCEPT { } // new allocator is called
(gdb)
std::vector<DRAMSim::BusPacket*, std::allocatorDRAMSim::BusPacket* >::vector (this=0x653568) at /usr/include/c++/4.7/bits/stl_vector.h:247
247 : _Base() { }
(gdb)
std::_Vector_base<DRAMSim::BusPacket*, std::allocatorDRAMSim::BusPacket* >::_Vector_base (this=0x653568) at /usr/include/c++/4.7/bits/stl_vector.h:126
126 : _M_impl() { }
(gdb)
std::_Vector_base<DRAMSim::BusPacket*, std::allocatorDRAMSim::BusPacket* >::_Vector_impl::_Vector_impl (this=0x653568) at /usr/include/c++/4.7/bits/stl_vector.h:88
88 : _Tp_alloc_type(), _M_start(0), _M_finish(0), _M_end_of_storage(0)
(gdb)
std::allocatorDRAMSim::BusPacket*::allocator (this=0x653568) at /usr/include/c++/4.7/bits/allocator.h:104
104 allocator() throw() { }
(gdb)
__gnu_cxx::new_allocatorDRAMSim::BusPacket*::new_allocator (this=0x653568) at /usr/include/c++/4.7/ext/new_allocator.h:69
69 new_allocator() _GLIBCXX_USE_NOEXCEPT { }
(gdb)
std::_Vector_base<DRAMSim::BusPacket*, std::allocatorDRAMSim::BusPacket* >::_Vector_impl::_Vector_impl (this=0x653568) at /usr/include/c++/4.7/bits/stl_vector.h:89
89 { }
(gdb)
std::allocator::allocator (this=0x7fffffffdf00) at /usr/include/c++/4.7/bits/allocator.h:104
104 allocator() throw() { }
(gdb)
__gnu_cxx::new_allocator::new_allocator (this=0x7fffffffdf00) at /usr/include/c++/4.7/ext/new_allocator.h:69
69 new_allocator() _GLIBCXX_USE_NOEXCEPT { }
(gdb)
std::vector<unsigned int, std::allocator >::vector (this=0x653580, __n=0, __value=@0x7fffffffdefc: 0, __a=...)
at /usr/include/c++/4.7/bits/stl_vector.h:294
294 : _Base(__n, __a)
(gdb)
std::_Vector_base<unsigned int, std::allocator >::_Vector_base (this=0x653580, __n=0, __a=...) at /usr/include/c++/4.7/bits/stl_vector.h:136
136 : _M_impl(__a) // 0x653580 - 0x653568 = 12 ?????
(gdb)
std::_Vector_base<unsigned int, std::allocator >::_Vector_impl::_Vector_impl (this=0x653580, __a=...) at /usr/include/c++/4.7/bits/stl_vector.h:92
92 : _Tp_alloc_type(__a), _M_start(0), _M_finish(0), _M_end_of_storage(0)
(gdb)
std::allocator::allocator (this=0x653580, __a=...) at /usr/include/c++/4.7/bits/allocator.h:107
107 : __glibcxx_base_allocator<_Tp>(__a) { }
(gdb)
__gnu_cxx::new_allocator::new_allocator (this=0x653580) at /usr/include/c++/4.7/ext/new_allocator.h:71
71 new_allocator(const new_allocator&) _GLIBCXX_USE_NOEXCEPT { }
(gdb)
std::_Vector_base<unsigned int, std::allocator >::_Vector_impl::_Vector_impl (this=0x653580, __a=...) at /usr/include/c++/4.7/bits/stl_vector.h:93
93 { }
(gdb)
std::_Vector_base<unsigned int, std::allocator >::_Vector_base (this=0x653580, __n=0, __a=...) at /usr/include/c++/4.7/bits/stl_vector.h:137
137 { _M_create_storage(__n); }
(gdb)
std::_Vector_base<unsigned int, std::allocator >::_M_create_storage (this=0x653580, __n=0) at /usr/include/c++/4.7/bits/stl_vector.h:182
182 this->_M_impl._M_start = this->_M_allocate(__n);
(gdb)
std::_Vector_base<unsigned int, std::allocator >::_M_allocate (this=0x653580, __n=0) at /usr/include/c++/4.7/bits/stl_vector.h:169
169 { return __n != 0 ? _M_impl.allocate(__n) : 0; }
(gdb)
std::_Vector_base<unsigned int, std::allocator >::_M_create_storage (this=0x653580, __n=0) at /usr/include/c++/4.7/bits/stl_vector.h:183
183 this->_M_impl._M_finish = this->_M_impl._M_start;
(gdb)
184 this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n;
(gdb)
185 } //till now nothing new just like before
(gdb)
std::vector<unsigned int, std::allocator >::vector (this=0x653580, __n=0, __value=@0x7fffffffdefc: 0, __a=...)
at /usr/include/c++/4.7/bits/stl_vector.h:295
295 { _M_fill_initialize(__n, __value); }
(gdb)
std::vector<unsigned int, std::allocator >::_M_fill_initialize (this=0x653580, __n=0, __value=@0x7fffffffdefc: 0)
at /usr/include/c++/4.7/bits/stl_vector.h:1181
1181 std::__uninitialized_fill_n_a(this->_M_impl._M_start, __n, __value,
(gdb)
std::_Vector_base<unsigned int, std::allocator >::_M_get_Tp_allocator (this=0x653580) at /usr/include/c++/4.7/bits/stl_vector.h:115
115 { return _static_cast<Tp_alloc_type>(&this->_M_impl); }
(gdb)

std::__uninitialized_fill_n_a<unsigned int*, unsigned long, unsigned int, unsigned int> (__first=0x0, __n=0, __x=@0x7fffffffdefc: 0)
at /usr/include/c++/4.7/bits/stl_uninitialized.h:336
336 { std::uninitialized_fill_n(__first, __n, __x); }
(gdb)
std::uninitialized_fill_n<unsigned int*, unsigned long, unsigned int> (__first=0x0, __n=0, __x=@0x7fffffffdefc: 0) at /usr/include/c++/4.7/bits/stl_uninitialized.h:225
225 std::__uninitialized_fill_n<__is_trivial(_ValueType)>::

(gdb)
std::__uninitialized_fill_n::__uninit_fill_n<unsigned int*, unsigned long, unsigned int> (__first=0x0, __n=0, __x=@0x7fffffffdefc: 0)
at /usr/include/c++/4.7/bits/stl_uninitialized.h:206
206 { std::fill_n(__first, __n, __x); }
(gdb)
std::fill_n<unsigned int*, unsigned long, unsigned int> (__first=0x0, __n=0, __value=@0x7fffffffdefc: 0) at /usr/include/c++/4.7/bits/stl_algobase.h:780
780 return _OI(std::__fill_n_a(std::__niter_base(__first), __n, __value));
(gdb)
std::__niter_base<unsigned int*> (__it=0x0) at /usr/include/c++/4.7/bits/stl_algobase.h:272
272 { return std::_Niter_base<_Iterator>::_S_base(__it); }
(gdb)
std::_Iter_base<unsigned int*, false>::_S_base (__it=0x0) at /usr/include/c++/4.7/bits/stl_iterator_base_types.h:214
214 { return __it; }
(gdb)

std::__fill_n_a<unsigned int*, unsigned long, unsigned int> (__first=0x0, __n=0, __value=@0x7fffffffdefc: 0) at /usr/include/c++/4.7/bits/stl_algobase.h:742
742 const _Tp __tmp = __value;
(gdb)
743 for (__decltype(__n + 0) __niter = __n;
(gdb)
746 return __first;
(gdb)
747 }
(gdb)
std::fill_n<unsigned int*, unsigned long, unsigned int> (__first=0x0, __n=0, __value=@0x7fffffffdefc: 0) at /usr/include/c++/4.7/bits/stl_algobase.h:781
781 }
(gdb)
std::uninitialized_fill_n<unsigned int*, unsigned long, unsigned int> (__first=0x0, __n=0, __x=@0x7fffffffdefc: 0) at /usr/include/c++/4.7/bits/stl_uninitialized.h:227
227 }
(gdb)
std::vector<unsigned int, std::allocator >::_M_fill_initialize (this=0x653580, __n=0, __value=@0x7fffffffdefc: 0)
at /usr/include/c++/4.7/bits/stl_vector.h:1183
1183 this->_M_impl._M_finish = this->_M_impl._M_end_of_storage;
(gdb)
1184 }
(gdb)
std::allocator::~allocator (this=0x7fffffffdf00, __in_chrg=) at /usr/include/c++/4.7/bits/allocator.h:112
112 ~allocator() throw() { }
(gdb)
__gnu_cxx::new_allocator::~new_allocator (this=0x7fffffffdf00, __in_chrg=) at /usr/include/c++/4.7/ext/new_allocator.h:76
76 ~new_allocator() _GLIBCXX_USE_NOEXCEPT { }
(gdb)
std::allocatorDRAMSim::Bank::allocator (this=0x7fffffffdefb) at /usr/include/c++/4.7/bits/allocator.h:104
104 allocator() throw() { }
(gdb)
__gnu_cxx::new_allocatorDRAMSim::Bank::new_allocator (this=0x7fffffffdefb) at /usr/include/c++/4.7/ext/new_allocator.h:69
69 new_allocator() _GLIBCXX_USE_NOEXCEPT { }
(gdb)
std::vector<DRAMSim::Bank, std::allocatorDRAMSim::Bank >::vector (this=0x653598, __n=8, __value=..., __a=...) at /usr/include/c++/4.7/bits/stl_vector.h:294
294 : _Base(__n, __a) //here is __n =8 which returns the NUM_BANKS
(gdb)
std::_Vector_base<DRAMSim::Bank, std::allocatorDRAMSim::Bank >::_Vector_base (this=0x653598, __n=8, __a=...) at /usr/include/c++/4.7/bits/stl_vector.h:136
136 : _M_impl(__a)
(gdb)
std::_Vector_base<DRAMSim::Bank, std::allocatorDRAMSim::Bank >::_Vector_impl::_Vector_impl (this=0x653598, __a=...) at /usr/include/c++/4.7/bits/stl_vector.h:92
92 : _Tp_alloc_type(__a), _M_start(0), _M_finish(0), _M_end_of_storage(0)
(gdb)
std::allocatorDRAMSim::Bank::allocator (this=0x653598, __a=...) at /usr/include/c++/4.7/bits/allocator.h:107
107 : __glibcxx_base_allocator<_Tp>(__a) { }
(gdb)
__gnu_cxx::new_allocatorDRAMSim::Bank::new_allocator (this=0x653598) at /usr/include/c++/4.7/ext/new_allocator.h:71
71 new_allocator(const new_allocator&) _GLIBCXX_USE_NOEXCEPT { }
(gdb)
std::_Vector_base<DRAMSim::Bank, std::allocatorDRAMSim::Bank >::_Vector_impl::_Vector_impl (this=0x653598, __a=...) at /usr/include/c++/4.7/bits/stl_vector.h:93
93 { }
(gdb)
std::_Vector_base<DRAMSim::Bank, std::allocatorDRAMSim::Bank >::_Vector_base (this=0x653598, __n=8, __a=...) at /usr/include/c++/4.7/bits/stl_vector.h:137
137 { _M_create_storage(__n); }
(gdb)
std::_Vector_base<DRAMSim::Bank, std::allocatorDRAMSim::Bank >::_M_create_storage (this=0x653598, __n=8) at /usr/include/c++/4.7/bits/stl_vector.h:182
182 this->_M_impl._M_start = this->_M_allocate(__n);
(gdb)
std::_Vector_base<DRAMSim::Bank, std::allocatorDRAMSim::Bank >::_M_allocate (this=0x653598, __n=8) at /usr/include/c++/4.7/bits/stl_vector.h:169
169 { return __n != 0 ? _M_impl.allocate(__n) : 0; } //here _n !=0 so go to allocate
(gdb)
__gnu_cxx::new_allocatorDRAMSim::Bank::allocate (this=0x653598, __n=8) at /usr/include/c++/4.7/ext/new_allocator.h:91
91 if (__n > this->max_size()) //How to get the max_size () ??
(gdb)
__gnu_cxx::new_allocatorDRAMSim::Bank::max_size (this=0x653598) at /usr/include/c++/4.7/ext/new_allocator.h:104
104 { return size_t(-1) / sizeof(_Tp); }
(gdb)
__gnu_cxx::new_allocatorDRAMSim::Bank::allocate (this=0x653598, __n=8) at /usr/include/c++/4.7/ext/new_allocator.h:94
94 return static_cast<Tp>(::operator new(__n * sizeof(Tp))); //from here it detrmines that the if statement return no and create new object n size of (_Tp)
(gdb)
95 }
(gdb)
std::_Vector_base<DRAMSim::Bank, std::allocatorDRAMSim::Bank >::_M_create_storage (this=0x653598, __n=8) at /usr/include/c++/4.7/bits/stl_vector.h:183
183 this->_M_impl._M_finish = this->_M_impl._M_start;
(gdb)
184 this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n;
(gdb)
185 }
(gdb)
std::vector<DRAMSim::Bank, std::allocatorDRAMSim::Bank >::vector (this=0x653598, __n=8, __value=..., __a=...) at /usr/include/c++/4.7/bits/stl_vector.h:295
295 { _M_fill_initialize(__n, __value); }
(gdb)
std::vector<DRAMSim::Bank, std::allocatorDRAMSim::Bank >::_M_fill_initialize (this=0x653598, __n=8, __value=...) at /usr/include/c++/4.7/bits/stl_vector.h:1181
1181 std::__uninitialized_fill_n_a(this->_M_impl._M_start, __n, __value,_M_get_Tp_allocator());
(gdb)
std::_Vector_base<DRAMSim::Bank, std::allocatorDRAMSim::Bank >::_M_get_Tp_allocator (this=0x653598) at /usr/include/c++/4.7/bits/stl_vector.h:115
115 { return _static_cast<Tp_alloc_type>(&this->_M_impl); }
(gdb)
std::__uninitialized_fill_n_a<DRAMSim::Bank*, unsigned long, DRAMSim::Bank, DRAMSim::Bank> (__first=0x6535d0, __n=8, __x=...)
at /usr/include/c++/4.7/bits/stl_uninitialized.h:336
336 { std::uninitialized_fill_n(__first, __n, __x); }
(gdb)
std::uninitialized_fill_n<DRAMSim::Bank*, unsigned long, DRAMSim::Bank> (__first=0x6535d0, __n=8, __x=...) at /usr/include/c++/4.7/bits/stl_uninitialized.h:225
225 std::__uninitialized_fill_n<__is_trivial(_ValueType)>::
(gdb)

std::__uninitialized_fill_n::__uninit_fill_n<DRAMSim::Bank*, unsigned long, DRAMSim::Bank> (__first=0x6535d0, __n=8, __x=...)
at /usr/include/c++/4.7/bits/stl_uninitialized.h:185
185 _ForwardIterator __cur = __first;
(gdb)
188 for (; __n > 0; --__n, ++__cur)
(gdb)
189 std::_Construct(std::__addressof(*__cur), __x);

(gdb)
std::__addressofDRAMSim::Bank (__r=...) at /usr/include/c++/4.7/bits/move.h:50

50 (&const_cast<char&>(reinterpret_cast<const volatile char&>(__r)));
(gdb)
51 }
(gdb)
std::_Construct<DRAMSim::Bank, DRAMSim::Bank> (__p=0x6535d0, __value=...) at /usr/include/c++/4.7/bits/stl_construct.h:85
85 ::new(static_cast<void*>(__p)) _T1(__value);
(gdb)
operator new (__p=0x6535d0) at /usr/include/c++/4.7/new:112
112 { return __p; }
(gdb)
DRAMSim::Bank::Bank (this=0x6535d0) at Bank.h:54
54 class Bank
(gdb)
std::vector<DRAMSim::Bank::_DataStruct*, std::allocatorDRAMSim::Bank::_DataStruct* >::vector (this=0x653620, __x=...) at /usr/include/c++/4.7/bits/stl_vector.h:309
309 _Alloc_traits::_S_select_on_copy(__x._M_get_Tp_allocator()))
(gdb)
std::_Vector_base<DRAMSim::Bank::_DataStruct*, std::allocatorDRAMSim::Bank::_DataStruct* >::_M_get_Tp_allocator (this=0x7fffffffdf50)
at /usr/include/c++/4.7/bits/stl_vector.h:119
119 { return _static_cast(&this->_M_impl); }
(gdb)
__gnu_cxx::__alloc_traitsstd::allocator<DRAMSim::Bank::_DataStruct* >::_S_select_on_copy (__a=...) at /usr/include/c++/4.7/ext/alloc_traits.h:211
211 static const _Alloc& _S_select_on_copy(const _Alloc& __a) { return __a; }
(gdb)
std::vector<DRAMSim::Bank::_DataStruct*, std::allocatorDRAMSim::Bank::_DataStruct* >::size (this=0x7fffffffdf50) at /usr/include/c++/4.7/bits/stl_vector.h:626
626 { return size_type(this->_M_impl._M_finish - this->_M_impl._M_start); }
(gdb)
std::_Vector_base<DRAMSim::Bank::_DataStruct*, std::allocatorDRAMSim::Bank::_DataStruct* >::_Vector_base (this=0x653620, __n=18446744073709547290, __a=...)
at /usr/include/c++/4.7/bits/stl_vector.h:136
136 : _M_impl(__a)
(gdb)
std::_Vector_base<DRAMSim::Bank::_DataStruct*, std::allocatorDRAMSim::Bank::_DataStruct* >::_Vector_impl::_Vector_impl (this=0x653620, __a=...)
at /usr/include/c++/4.7/bits/stl_vector.h:92
92 : _Tp_alloc_type(__a), _M_start(0), _M_finish(0), _M_end_of_storage(0)
(gdb)
std::allocatorDRAMSim::Bank::_DataStruct*::allocator (this=0x653620, __a=...) at /usr/include/c++/4.7/bits/allocator.h:107
107 : __glibcxx_base_allocator<_Tp>(__a) { }
(gdb)
__gnu_cxx::new_allocatorDRAMSim::Bank::_DataStruct*::new_allocator (this=0x653620) at /usr/include/c++/4.7/ext/new_allocator.h:71
71 new_allocator(const new_allocator&) _GLIBCXX_USE_NOEXCEPT { }
(gdb)
std::_Vector_base<DRAMSim::Bank::_DataStruct*, std::allocatorDRAMSim::Bank::_DataStruct* >::_Vector_impl::_Vector_impl (this=0x653620, __a=...)
at /usr/include/c++/4.7/bits/stl_vector.h:93
93 { }
(gdb)
std::_Vector_base<DRAMSim::Bank::_DataStruct*, std::allocatorDRAMSim::Bank::_DataStruct* >::_Vector_base (this=0x653620, __n=18446744073709547290, __a=...)
at /usr/include/c++/4.7/bits/stl_vector.h:137
137 { _M_create_storage(__n); }
(gdb)
std::_Vector_base<DRAMSim::Bank::_DataStruct*, std::allocatorDRAMSim::Bank::_DataStruct* >::_M_create_storage (this=0x653620, __n=18446744073709547290)
at /usr/include/c++/4.7/bits/stl_vector.h:182
182 this->_M_impl._M_start = this->_M_allocate(__n);
(gdb)
std::_Vector_base<DRAMSim::Bank::_DataStruct*, std::allocatorDRAMSim::Bank::_DataStruct* >::_M_allocate (this=0x653620, __n=18446744073709547290)
at /usr/include/c++/4.7/bits/stl_vector.h:169
169 { return __n != 0 ? _M_impl.allocate(__n) : 0; } wont return zero ofcourse
(gdb)
__gnu_cxx::new_allocatorDRAMSim::Bank::_DataStruct*::allocate (this=0x653620, __n=18446744073709547290) at /usr/include/c++/4.7/ext/new_allocator.h:91
91 if (__n > this->max_size()) // greater ya ???? __n=18446744073709547290
(gdb)
__gnu_cxx::new_allocatorDRAMSim::Bank::_DataStruct*::max_size (this=0x653620) at /usr/include/c++/4.7/ext/new_allocator.h:104
104 { return size_t(-1) / sizeof(_Tp); }
(gdb)
__gnu_cxx::new_allocatorDRAMSim::Bank::_DataStruct*::allocate (this=0x653620, __n=18446744073709547290) at /usr/include/c++/4.7/ext/new_allocator.h:92
92 std::__throw_bad_alloc();
(gdb)
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant