Tag

virtual functions

0 views collected around this technical thread.

Tencent Architect
Tencent Architect
May 14, 2024 · Fundamentals

Unlocking C++ Object Memory Layout: From Basics to Inheritance and ASLR

This article walks through C++ object memory layout using concrete examples, covering basic data members, methods, private and static members, inheritance (with and without virtual functions), compiler optimizations, and address‑space layout randomization, all demonstrated with GDB inspections and code snippets.

ASLRC++GDB
0 likes · 22 min read
Unlocking C++ Object Memory Layout: From Basics to Inheritance and ASLR
Tencent Cloud Developer
Tencent Cloud Developer
Nov 2, 2022 · Fundamentals

C++ Performance Traps: Hidden Costs of Abstraction and Compiler Optimization Pitfalls

Modern C++ performance suffers when seemingly harmless abstractions—such as virtual functions, hidden copies, non‑trivial destructors, overused std::shared_ptr, type‑erasing wrappers, std::variant/optional, and std::async—prevent inlining and efficient memory use, while patterns like std::move on returns, hidden destructors in tail recursion, and branchy loops thwart NRVO, tail‑call, and auto‑vectorization optimizations.

C++Compiler OptimizationNRVO
0 likes · 16 min read
C++ Performance Traps: Hidden Costs of Abstraction and Compiler Optimization Pitfalls