lundi 14 août 2017

std::bad_alloc on my_vector.push_back(class_object) in macos but no error in ubuntu

I am using the below code to add a class object to a vector using push_back.

std::vector<custom_class_type> my_vector;
custom_class_type object_name(params);
my_vector.push_back(object_name);

When I run this code on macos, I get the below error:

final(67654,0x7fffa967a3c0) malloc: * mach_vm_map(size=8583983401233895424) failed (error code=3) * error: can't allocate region *** set a breakpoint in malloc_error_break to debug libc++abi.dylib: terminating with uncaught exception of type std::bad_alloc: std::bad_alloc [1] 67654 abort ./final

But the same code runs perfectly fine on ubuntu 16.04.

Is there something that I should be aware of when running the code on macos?

Aucun commentaire:

Enregistrer un commentaire