OOM thrown when creating a panel of thumbnails from several large-sized (>1MB) .jpg files

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Out of Memory displaying Thumbnails in Windows 7 64-Bit with 12GB installed<br/>
See more: .NET4<br/>
My VB Code:<br/>
Private Sub Thumb()<br/>
Dim img As Image<br/>
img = Image.FromFile(F$)F$ = HiRes 1-7MByte.jpg Canon camera Pic File type .jpg<br/>
imgThumb = img.GetThumbnailImage(51, 57, Nothing, New IntPtr())<br/>
img.Dispose()<br/>
End Sub<br/>
<br/>
Private Sub DisplayPanelOf100Thumbnails()<br/>
Dim J As Integer Public F$ has been previously declared in Module1<br/>
For J = 1 To 100 PB1 .. PB100 are PictureBoxes Size(51,57) on a Form GroupBox<br/>
F$ = ListAddFiles.items(J)ListAddFiles is a ListBox filled with picture<br/>
file names that were selected by the user from OpenFileDialog1 <br/>
If J = 1 Then<br/>
Thumb()<br/>
PB1.Image = imgThumb : imgThumb.Dispose()<br/>
PB1.SizeMode = PictureBoxSizeMode.StretchImage<br/>
.<br/>
loop continues for PicturePoxes PB1 through PB100<br/>
.<br/>
Else If J = 100 Then<br/>
Thumb()<br/>
PB100.Image = imgThumb : imgThumb.Dispose()<br/>
PB100.SizeMode = PictureBoxSizeMode.StretchImage<br/>
End If<br/>
Next J<br/>
End Sub<br/>
<br/>
Issue #1:<br/>
If the .jpg picture files are <300KB approx. then this code works fine without throwing any exception.<br/>
<br/>
But if the .jpg files are Hi-Res .jpg images with file sizes >1MB I get an<br/>
Out Of Memory Exception consistently at approx. the 36th -40th PictureBox being updated with a thumbnail.<br/>
The problem is not with the picture files, each will individually load into<br/>
a Thumbnail PictureBox if they are the only one or a member of a smaller<br/>
group selected from the OpenFileDialog1 control<br/>
This problem occurs with: target PC: Windows 7 Ultimate 64Bit SP2 with 12GByte RAM installed I7 970 processor with 8-Cores, 3GB DDR5 NVIDIA graphics<br/>
This problem does not occur on a PC: Windows XP Prof SP3 32Bit 4GB RAM AMD6000+<br/>
Dual-Core Processor with NVidia 520 PCix graphics 1GB<br/>
<br/>
Issue #2:<br/>
Updating a Thumbnail PictureBox takes about .5 second on the XP system and the full panel of 100 Thumbs takes about 50Sec...much too long!!! If the Win7 system<br/>
does not crash, large files can take several seconds to fill 100 Pictureboxes<br/>
<br/>
Issue #3: If I change the size of the Thumbnail in Thumb() it does<br/>
not seem to change the displayed picture or the speed of displaying thumbs.<br/>
i.e. imgThumb = img.GetThumbnailImage(4,4, Nothing, New IntPtr()) seems to give<br/>
the same results and performance ..a picture size of 4 by 4 is not displayed by<br/>
my visual judgement..it seems quite complex and clear<br/>
<br/>
Issue #4: If the user selects more than approx 1500 files on the XP PC system, the<br/>
FileDialog1 gives a false "File BlaBha " does not exist. If I select any indiv.<br/>
Picture file in the target directory, or if I select any number of picture files<br/>
less than approx 1500 files, there is no problem. The filename returned with the<br/>
"Does Not Exist" exception is not a filename in the selection directory.<br/>
<br/>
Issue #5:<br/>
If the user tries to select more<br/>
than 1500 file names to be candidates for viewing, then the<br/>
OpenFileDialog1 goes into turtle-speed mode on the XP. This occurs during the<br/>
selection process in the OpenFileDialog1...not after the "OK" button is has been clicked.<br/>
<br/>
Issue #6: If the Windows 7 systems user attempts to select more than 5000 files to be added for viewing, the OpenFileDialog1 selection process starts to slow to<br/>
turtle speed while the user is selecting files...before these file names are added to the ListAddFiles listbox,<br/>
<br/>
Any Help on this speed of display problem?<br/>
Any Help on the Thumbnail display code Out Of Memory Problem?<br/>
Any Help on the OpenFileDialog1 "Turtle-Mode" Large number of selected problem?

View the full article
 
Back
Top