Skip to Content
Effective C++, Third Edition
book

Effective C++, Third Edition

by Scott Meyers
May 2005
Intermediate to advanced
320 pages
10h 24m
English
Addison-Wesley Professional
Content preview from Effective C++, Third Edition

3. Resource Management

A resource is something that, once you're done using it, you need to return to the system. If you don't, bad things happen. In C++ programs, the most commonly used resource is dynamically allocated memory (if you allocate memory and never deallocate it, you've got a memory leak), but memory is only one of many resources you must manage. Other common resources include file descriptors, mutex locks, fonts and brushes in graphical user interfaces (GUIs), database connections, and network sockets. Regardless of the resource, it's important that it be released when you're finished with it.

Trying to ensure this by hand is difficult under any conditions, but when you consider exceptions, functions with multiple return paths, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

The C++ Programming Language, 4th Edition

The C++ Programming Language, 4th Edition

Bjarne Stroustrup

Publisher Resources

ISBN: 0321334876Purchase book