[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bug: Spawning short-lived threads may crash the memory allocator
From: |
Mattias Hellström |
Subject: |
Bug: Spawning short-lived threads may crash the memory allocator |
Date: |
Wed, 31 Oct 2001 19:30:08 +0100 |
Greetings.
We like to report a bug we call "Spawning short-lived threads may crash the
memory allocator".
The bug most probably resides in pthreads.
Main part of the memtester program:
class TSecondThread : public TDetachThread{
private:
TBinarySignal* Signal;
char MemoryBlock[TEST_BLOCK_SIZE];
protected:
// Overloads pure virtual function in base class.
virtual void Execute() throw ();
public:
TSecondThread(TBinarySignal& signal);
};
TSecondThread::TSecondThread(TBinarySignal& signal){
Signal = &signal;
}
void TSecondThread::Execute() throw (){
TBinarySignal* s = Signal;
delete this;
s->Signal();
}
void main(int argc, char* argv[]){
TBinarySignal signal;
while (true) {
TSecondThread* secondThread = new TSecondThread(signal);
secondThread->Start();
signal.Wait();
}
}
To reproduce, extract tarball, run make, run memtester. Segmentation fault
should come within
a second or so.
<<memtester3.tgz>>
memtester3.tgz
Description: Binary data
- Bug: Spawning short-lived threads may crash the memory allocator,
Mattias Hellström <=