JochenKalmbach / StackWalker

Walking the callstack in windows applications
BSD 2-Clause "Simplified" License
831 stars 182 forks source link

No dynamic allocation #16

Closed domalb closed 6 years ago

domalb commented 6 years ago

remove uses of malloc & free. all dynamic allocations are replaced with member or stack place holders

domalb commented 6 years ago

Hi, I'm proposing some changes in the implementation to avoid any dynamic allocation.

Avoiding dynamic allocation is important in cases of error handling. Typically, the out-of-memory scenario is a good use case for callstack printing, but if the StackWalker itself requires memory allocation to work, we are doomed. Heap corruption is another good use case which benefits from avoiding dynamic allocation.

Does this make sense?

JochenKalmbach commented 6 years ago

Using stack allocations is not a good idea, if you use the stackwalker in dumping the stack if you have low stack-memory.... I will not merge this... dynamic memory might be less error prone, but it is not usefull for this requirement. Also improving code only without adding any benefit is not a goal. Also you are using some magic numbers (STACKWALK_INTERNAL_SIZE) which will also not get merged... Calling constructor explizit is also not a good idea... also what is about multi-threading? So this merge will not be accepted

domalb commented 6 years ago

Okay, I understand your point.