[Qt-interest] Memory issues with painter->drawText()
Martin Hofius
Martin at hofius-online.com
Tue May 19 12:21:00 CEST 2009
Hi Shiva,
I've tested your example - and I got a memory consumption of about 4MB (RES)
on the first paint event and about 12MB after some more events. But I also
noticed that the memory consumption doesn't grow after 100000 paint events .
I guess that qt allocates some buffers for
- the font
- the painted contents (all pixels of the current window)
This together with the memomory allocation algorithm leads to this memory
consumption. But it isn't a memory leak...
When you close the widget/window in your example, the window object is not
released - you only hide the window, therefor the memory remains allocated.
Greetings
Martin
Am Dienstag, 19. Mai 2009 schrieb shiva sitamraju:
> Hi everyone,
>
> Here is my issue. Whenever i call painter->drawText (with some newlines in
> the text) the resident memory usage shoots up by around 10MB. Also to add
> to the problems, the memory is not released when I close the widget.
>
> I am attaching the code to test this problem. I create a widget with a
> pushbutton and on clicking the button I set a flag, due to which text is
> drawn in paintEvent.
>
> After the paintEvent starts painting text the resident memory (res shown in
> top) shoots up by around 10MB which is not released even after I close the
> widget. Virtual memory usage also shoots up by a large number(around 100MB)
> and is not reclaimed.
>
> I would be glad if someone can throw some insight on why this is happening.
>
> Thanks
> -Shiva
More information about the Qt-interest-old
mailing list