* Mark Wielaard: > I'll see if I can create a case where that is a problem. Then we can > see how to adjust things to use less pthread_keys. Is there a different > pattern we can use?
It's unclear what purpose thread-local storage serves in this context. You already have a Dwarf *. I would consider adding some sort of clone function which creates a shallow Dwarf * with its own embedded allocator or something like that. This assumes that memory allocation is actually a performance problem, otherwise you could let malloc handle the details.