Closed gstvrmrlpz closed 5 years ago
Considering it segfaults using the standard malloc I think the problem is in your code
./stack
n compress
1 966209
free(): double free detected in tcache 2
stack: stack.cc:32: unsigned int work(std::atomic<bool>&, stack&) [with stack = compress::stack<int>]: Assertion `s.pop() == 0x12345678' failed.
Aborted (core dumped)
my code is full of bugs but I thought a call to new aka _memory_allocate should always success while there is enough free memory...
No, not when you have corrupted the memory heap with bad calls (like a double free)
From the readme: "All entry points assume the passed values are valid, for example passing an invalid pointer to free would most likely result in a segmentation fault. The library does not try to guard against errors."
A half finish lockfree stack implementation is triggering a bug in _memory_allocate. Code + exe + core in https://pccito.ugr.es/bug.tar.xz