for (int j = 0; j < 1000; ++j)
DrawArea* d = new DrawArea();
for (int i = 0; i < 10000; ++i)
TTFText* ptr = d->text("abc", "arial.ttf", 10);
The above code should run the DrawArea::text for around 10 million times. I did not see any memory leak. In Visual Studio, there is a "Diagnostic Tools" page that shows the process memory usage. It does not show any memory increase.
When the MFC application ends, Visual Studio should also display any memory leak it has detected. It does not detect any memory leak in my test case.
Note that if you create a TTFText, then delete it, it will appear some memory is not released. It is because ChartDirector can cache some commonly by unchanging items for speed. One example is the font and and rendered text. If you draw some text such as "120", it is very likely your application will show the same characters "1", "2" or "0", using the same font and same font size again. So it will cache the font and the rendered text. If you repeat the code, the memory will not increase indefinitely, because ChartDirector will reuse the cache. So we test memory leak by running the code many times. If the memory usage is reasonable and does not increase indefinitely, there should be no leak.