[racket] bitmap% size in memory

From: Bert De Ketelaere (bedeke at hotmail.com)
Date: Wed Dec 19 02:10:37 EST 2012

Hello all,

When loading large pictures (± 4300x2600 pixels) I would expect that they takes up around 45Mb of memory.
But when I monitored my program in windows task-manager I noticed it was more in the neighborhood of 100Mb (after garbage collection, the in-between values goes over 200Mb)
Hoping to find a reason for this I went looking into racket/draw/bitmap and noticed that there is a variable "shadow" that is set to a zeroed out byte-string, the size of the picture.  But the only thing happening with this "shadow" is it's definition and a set!.  It is never read.
I tried removing the two references to "shadow", and in my programs everythings seems to keep working, with the added bonus that the picture now indeed takes only around 45Mb instead of 100Mb.

two questions:
As far as I understand classes, since shadow is locally defined, no parent or child can access shadow, so removing it should be ok.  Is this right?
Is there a way to see how much memory an object occupies?

Bert

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20121219/904e1992/attachment.html>

Posted on the users mailing list.