Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


Out of Memory error while loading bitmap


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-15-2007, 10:17 AM
Knows the basics
 
Join Date: Apr 2007
Location: Netherlands
Posts: 86
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, 12:34 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,343
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

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD

DLL Version Listing
Reply With Quote
  #3 (permalink)  
Old 05-15-2007, 12:40 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,199
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, 01:12 PM
Knows the basics
 
Join Date: Apr 2007
Location: Netherlands
Posts: 86
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 On
Pingbacks are On
Refbacks are On

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


All times are GMT. The time now is 04:28 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0