Skip to content

Latest commit

 

History

History
22 lines (15 loc) · 2.01 KB

memory-management-with-cstringt.md

File metadata and controls

22 lines (15 loc) · 2.01 KB
description title ms.date helpviewer_keywords ms.assetid
Learn more about: Memory Management with CStringT
Memory Management with CStringT
11/04/2016
CString objects, memory management
memory [C++], usage
IAtlStringMgr class, using
strings [C++], custom memory management
CFixedStringT class, description of
strings [C++], memory management
CStringT class, memory management
88b8342d-19b5-48c4-9cf6-e4c44cece21e

Memory Management with CStringT

Class CStringT is a template class used to manipulate variable-length character strings. The memory to hold these strings is allocated and released through a string manager object, associated with each instance of CStringT. MFC and ATL provide default instantiations of CStringT, called CString, CStringA, and CStringW, which manipulate strings of different character types. These character types are of type TCHAR, char, and wchar_t, respectively. These default string types use a string manager that allocates memory from the process heap (in ATL) or the CRT heap (in MFC). For typical applications, this memory allocation scheme is sufficient. However, for code making intensive use of strings (or multithreaded code) the default memory managers may not perform optimally. This topic describes how to override the default memory management behavior of CStringT, creating allocators specifically optimized for the task at hand.

See also

CustomString sample