Skip to content

Latest commit

 

History

History
58 lines (52 loc) · 2.46 KB

memory-management-with-cstringt.md

File metadata and controls

58 lines (52 loc) · 2.46 KB
title Memory Management with CStringT | Microsoft Docs
ms.custom
ms.date 11/04/2016
ms.reviewer
ms.suite
ms.technology
cpp-windows
ms.tgt_pltfrm
ms.topic reference
f1_keywords
CStringT
ATL::CStringT
ATL.CStringT
dev_langs
C++
helpviewer_keywords
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
ms.assetid 88b8342d-19b5-48c4-9cf6-e4c44cece21e
caps.latest.revision 10
author mikeblome
ms.author mblome
manager ghogen
translation.priority.ht
cs-cz
de-de
es-es
fr-fr
it-it
ja-jp
ko-kr
pl-pl
pt-br
ru-ru
tr-tr
zh-cn
zh-tw

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