Closing TCanvas

Is it erroneous to class TCanvas while coding in c++ (I mean not in ROOT platform), since no graphic window is going to show up? And in this end c1.Close() causes memory leak.

    definitely lost: 4 bytes in 1 blocks

If we don’t close TCanvas, however, when is it going out of scope so that foo.Draw() can not longer be used? Is it a good practice to leave TCanvas “on” until the end of a function?

Thanks.

can you provide a small example showing this ?

This one is fast,
with empty main:

==22009== LEAK SUMMARY:
==22009==    definitely lost: 0 bytes in 0 blocks
==22009==    indirectly lost: 0 bytes in 0 blocks
==22009==      possibly lost: 67,827 bytes in 2,213 blocks
==22009==    still reachable: 2,842,101 bytes in 60,287 blocks
==22009==         suppressed: 0 bytes in 0 blocks
==22009== Rerun with --leak-check=full to see details of leaked memory

with

TCanvas c1;
c1.Close();
==6308== LEAK SUMMARY:
==6308==    definitely lost: 4 bytes in 1 blocks
==6308==    indirectly lost: 0 bytes in 0 blocks
==6308==      possibly lost: 408,188 bytes in 6,713 blocks
==6308==    still reachable: 3,899,504 bytes in 84,115 blocks
==6308==         suppressed: 0 bytes in 0 blocks
==6308== Rerun with --leak-check=full to see details of leaked memory

Is there a method to get rid of the possibly lost too?
That will be really helpful because valgrind takes a long time.
Thanks.