The initial stack of LockStack is malloced and lives on the heap. It just consists of one slot. It would be better to let this stack live inside the LockStack object.
Gives us a much higher chance of cache hits when accessing lockstack slots via lockstack header. We eliminate (in the majority of cases) or at least postpone the first malloc call. And we use actually less memory (not that it matters much) per thread since malloc overhead is at least 48 bytes per allocation, probably more.
Gives us a much higher chance of cache hits when accessing lockstack slots via lockstack header. We eliminate (in the majority of cases) or at least postpone the first malloc call. And we use actually less memory (not that it matters much) per thread since malloc overhead is at least 48 bytes per allocation, probably more.