L
lord.zoltar
Hello,
I have an ImageList that will store a large number of images, but if
it starts using too much memory, I'd like to be able to purge it (or
part of it). The problem is, I'm not sure how to determine how much
memory is being used by this object. I've read that Marshal.SizeOf()
can determine the size of the object, but I get an exception:
"Type 'System.Windows.Forms.ImageList+ImageCollection' cannot be
marshaled as an unmanaged structure; no meaningful size or offset can
be computed."
Similar exception when I tried to iterate through the list and call
SizeOf on each Image in the list.
I could add up the sizes of the images as their loaded, but I'm not
sure how to determine the size, in bytes, of an Image object. Is there
a way I could access an Image as an array of bytes and then just look
at it's length?
I have an ImageList that will store a large number of images, but if
it starts using too much memory, I'd like to be able to purge it (or
part of it). The problem is, I'm not sure how to determine how much
memory is being used by this object. I've read that Marshal.SizeOf()
can determine the size of the object, but I get an exception:
"Type 'System.Windows.Forms.ImageList+ImageCollection' cannot be
marshaled as an unmanaged structure; no meaningful size or offset can
be computed."
Similar exception when I tried to iterate through the list and call
SizeOf on each Image in the list.
I could add up the sizes of the images as their loaded, but I'm not
sure how to determine the size, in bytes, of an Image object. Is there
a way I could access an Image as an array of bytes and then just look
at it's length?