Out of Memory error while loading bitmap

Discussion in 'Questions (Windows Mobile)' started by HARRY, May 15, 2007.

  1. HARRY

    HARRY Active Member Licensed User


    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)

    bmpsrc2.New1(PhotoPath & Photo2)

    bmpsrc3.New1(PhotoPath & Photo3)

    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.

  2. Cableguy

    Cableguy Expert Licensed User

    I think that all libs have a dispose property, so you can ...dispose.... of the previous image before showing the new one....
  3. Erel

    Erel Administrator Staff Member Licensed User

    I understand that each time the bitmaps are loaded with three new files.
    You can try:
    BmpSrc.New1 (...)
  4. HARRY

    HARRY Active Member Licensed User

    Erel, Paulo,

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

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice