Out of Memory error while loading bitmap

HARRY

Active Member
Licensed User
Longtime User
Hi,

In a program I load three new bitmaps each time when the user clicks on a table. Each bitmap has a size of 320 *240 and is displayed with a size of 80 * 60.

The code used to load and display the three bitmaps is:

bmpsrc1.New1(PhotoPath & Photo1)
drawer1.DrawImage1(bmpsrc1.Value,rectsrc1.Value,rectdes1.Value,true)
drawer1.Refresh2(rectdes1.Value)

bmpsrc2.New1(PhotoPath & Photo2)
drawer2.DrawImage1(bmpsrc2.Value,rectsrc2.Value,rectdes2.Value,true)
drawer2.Refresh2(rectdes2.Value)

bmpsrc3.New1(PhotoPath & Photo3)
drawer3.DrawImage1(bmpsrc3.Value,rectsrc3.Value,rectdes3.Value,true)
drawer3.Refresh2(rectdes3.Value)


On the PDA only, after 21 clicks I get the error message: OutOfMemoryException on the line bmpsrc3.New1(PhotoPath & Photo3)

I fear that each bmpsrc*.New1 statement claims additional memory, but I do not know:

1) How to free the memory used by previous bitmaps.

2) What the maximum size is of the memory made available for an application.

Please some help.


Harry
 

Cableguy

Expert
Licensed User
Longtime User
I think that all libs have a dispose property, so you can ...dispose.... of the previous image before showing the new one....
 

HARRY

Active Member
Licensed User
Longtime User
Erel, Paulo,

Thanks for your help. I exercised already with dispose, but forgot to add the object again.

Harry
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…