TryBugHunt

C++ memory exercises

Manual memory management in C++ is a frequent source of security vulnerabilities and stability crashes: returning pointers to stack variables, deleting pointers twice, or creating memory leaks with circular std::shared_ptr references.

Learn to spot invalid pointer arithmetic, RAII violations, and dangling references.

See the 13 exercisesOr follow the 30-day path

The memory bugs you will meet

The exercises

Errors you might be searching for

More JavaScript practice by topic

Questions

What is RAII in C++?

Resource Acquisition Is Initialization: bind resource lifetimes (heap memory, locks, file handles) to stack object lifetimes so destructors clean them up automatically.