Memory usage for SetWindowText
C / C++ / MFC
1
Posts
1
Posters
0
Views
1
Watching
-
I have a simple program used for a video overlay where I use a CStatic object to display the time. I was looking at the memory usage for the program and discovered that it was increasing by 4k every 3-4 seconds:(. I found that the following code was the culprit, to be more specific, the SetWindowText line. (The code is called every second)
CTime t1 = CTime::GetCurrentTime(); std::string time_str = (LPCTSTR)t1.Format("%H:%M:%S %d/%m/%y"); m_timeStatic.SetWindowText(time_str.c_str()); //memory increase
I swapped over to use a CString object instead but the same problem was encountered.m_timeString = time_str.c_str(); UpdateData(FALSE);
Please Help me!!!! Can anyone explain this!!!:confused::confused: ---