is00hcw / gperftools

Automatically exported from code.google.com/p/gperftools
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

[Patch] Fix profiler_unittest.cc fork() #588

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Call heap-profiler_unittest with the arguments 1 -2 (one iteration, 2 fork()ed 
children).

What is the expected output? What do you see instead?
Instead of running the test, the program crashes with a std::bad_alloc 
exception.
This is caused by unconditionally passing the number-of-threads-argument (0 or 
positive for threads, negative for fork()s) in RunManyThreads(), thus 
allocating an array of pthread_t of size -2.
Depending on the sign of the thread number argument either RunManyThreads or 
fork() should be called.

What version of the product are you using? On what operating system?
Git HEAD, Ubuntu 13.04, 3.8.0-19-generic

Please provide any additional information below.
Patch attached.

Best regards,
Hannes Weisbach

Original issue reported on code.google.com by hannes.w...@googlemail.com on 12 Nov 2013 at 11:43

Attachments:

GoogleCodeExporter commented 9 years ago
Merged. Thanks

Original comment by alkondratenko on 16 Nov 2013 at 8:17