Stack Unwinding
|
How Stack unwinding works - foo() is called, it acquires a Resource object - it then throws a std::runtime_error exception. - As a result, the stack starts unwinding, and the destructor for res is called to release the Resource - Then, exception is caught in the main() function. - This ensures that resources are properly cleaned up even in the presence of exceptions. |
- Stack Unwinding has runtime overhead
- How RUST removes this overhead
Runtime Type Information (RTTI)
- 1. Increased Binary size with RTTI
This metadata typically includes:
- type information tables (type descriptors)
- virtual function tables (vtables) used for dynamic dispatch etc
These tables increase the size of the binary, especially for programs with a large number of polymorphic classes.
- 2. Increased Execution time with RTTI
|