I don't think this requires another question, so I'm editing this extremely relevant one.
I had a code that would draw text by converting from char* to wchar_t*, and I suspected a memory error, as the program memory would go up as a crazy pace (5,000 K to 1,500,000 in minutes).
I suspected mbstowcs(), but I think I've found the problem now.
I am using a rather bad way of getting colors to draw things in general.
class MainClass {
public:
ID2D1SolidColorBrush* custom_color;
ID2D1SolidColorBrush get_rgba(float r, float g, float b, float a) {
// render is a validated ID2D1RenderTarget*
render->CreateSolidColorBrush(D2D1::ColorF(r,g,b,a),&custom_color);
return custom_color;
}
};
The memory usage increase is almost assuredly coming from this function. Are there any better ways I could return custom colors like this?