简体   繁体   中英

Calling Image.FromFile throws Out of memory exception

I have a function that fill data grid view and this function use paging

page size = 30

It's work fine until page 9 throw out of memory exception

I have windows server 2008 R2 64 bit,8 GB RAM

 row[1] = Image.FromFile(iconFullUrl); 

in this section of code the error occur

 row[1] = Image.FromFile(iconFullUrl); 

Adding my Comment as an Answer:

According to MSDN the OutOfMemory error can be caused by the file not having a valid image format or because GDI+ does not support the pixel format of the file.

Also as long as the image is not disposed the file will be marked as inuse

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM