Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
firamax  
#1 Posted : Sunday, July 8, 2007 7:33:40 PM(UTC)
firamax

Rank: Member

Groups: Member
Joined: 4/15/2007(UTC)
Posts: 25

Dear sirs,

we use aurigmaBitmapViewer control in order to view images as the code shows below:

aurigmaBitmapViewer.Bitmap = a file from hdd or memory(in case of scanning)

Which is the best way to release the memory occupied by the aurigmaBitmapViewer control when we are finished? .Dispose() is not a proper way cause later we will need to use it again.

aurigmaBitmapViewer.Bitmap = Nothing ?????
aurigmaBitmapViewer.Bitmap.Clear ??????

Any suggestion?

firemax
Alex Kon  
#2 Posted : Monday, July 9, 2007 11:50:25 AM(UTC)
Alex Kon

Rank: Advanced Member

Groups: Member
Joined: 1/31/2005(UTC)
Posts: 458

Was thanked: 5 time(s) in 5 post(s)
Hello,

It depends on whether you intend to use bitmap loaded from disk or memory in other parts of your program or not. If not -
Code:
aurigmaBitmapViewer.Bitmap.Clear()
method will free this loaded image and, of course, this will be much more memory effective. But if you intend to use this image in other parts - you have to use the following construction:
Code:
aurigmaBitmapViewer.Bitmap = Nothing

The BitmapViewer control itself doesn't consume a lot of memory. It stores just two bitmaps inside, their dimensions are less or equal to the dimensions of the BitmapViewer control. The only way to reduce these bitmaps is to change size of the control, but I think that it is not worth doing - gain will be too small.

If your application consumes excessively large amount of memory - try to find unnecessary bitmaps and dispose them, or optimize usage of bitmap objects.
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.