Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

Out of Memory error while loading bitmap

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-15-2007, 09:17 AM
Basic4ppc Veteran
 
Join Date: Apr 2007
Location: Netherlands
Posts: 222
Default Out of Memory error while loading bitmap

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,re ctdes1.Value,true)
drawer1.Refresh2(rectdes1.Value)

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

bmpsrc3.New1(PhotoPath & Photo3)
drawer3.DrawImage1(bmpsrc3.Value,rectsrc3.Value,re ctdes3.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
Reply With Quote
  #2 (permalink)  
Old 05-15-2007, 11:34 AM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 2,344
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

I think that all libs have a dispose property, so you can ...dispose.... of the previous image before showing the new one....
__________________
Paulo Gomes - Porto, Portugal - Living/Working in France
Mobile Device: Samsung Galaxy S, Android 2.3.4 CUstom ROM
Laptop: Toshiba NB100-130 (running on Win7Ultimate)

My Posts helped you? Consider Buying me a Porto Glass!
Reply With Quote
  #3 (permalink)  
Old 05-15-2007, 11:40 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,733
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

I understand that each time the bitmaps are loaded with three new files.
You can try:
bmpSrc.Dispose
AddObject("bmpSrc","Bitmap")
BmpSrc.New1 (...)
Reply With Quote
  #4 (permalink)  
Old 05-15-2007, 12:12 PM
Basic4ppc Veteran
 
Join Date: Apr 2007
Location: Netherlands
Posts: 222
Default

Erel, Paulo,

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

Harry
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Out of Memory when loading a photo Mr_Gee Questions (Windows Mobile) 6 10-23-2008 07:49 PM
Proper use of the .New methods, out of memory error kolbe Questions (Windows Mobile) 5 09-05-2008 01:37 PM
Out of Memory Exception Error on Load willisgt Questions (Windows Mobile) 9 03-01-2008 11:18 AM
out-of-memory-error based on timer after switching to V6 Frank Questions (Windows Mobile) 2 01-17-2008 03:26 PM
Error loading SQL Component conniemalan Questions (Windows Mobile) 1 07-27-2007 08:29 AM


All times are GMT. The time now is 06:59 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0