Out Of Memory Error

7 posts, 0 answers
  1. robertw102
    robertw102 avatar
    265 posts
    Member since:
    Jul 2007

    Posted 29 Sep 2009 Link to this post

    I'm using the RadBinaryImage control in a RadRotator controls like so:

    <telerik:RadRotator ID="rtPropertyImages" runat="server" ScrollDirection="Left" ItemWidth="203px" 
                                ItemHeight="136px" Height="136px" Width="203px" RotatorType="FromCode" ScrollDuration="2000"
                                <ItemTemplate> 
                                    <href="Property-Floor-Plan.aspx?id=<%#DataBinder.Eval(Container, "DataItem.Listing_ID")%>"> 
                                        <telerik:RadBinaryImage ID="imgProperty" runat="server" AutoAdjustImageControlSize="false" 
                                            DataValue='<%#Bind("ImageFile") %>' AlternateText='<%# Bind("Description") %>' 
                                            ToolTip='<%# Bind("Description") %>' Height="136px" Width="203px" ResizeMode="Crop" 
                                            BorderStyle="Solid" BorderColor="Black" BorderWidth="1px" /> 
                                    </a> 
                                </ItemTemplate> 
                            </telerik:RadRotator> 

    I keep getting this error after the page is posted back a couple of times using IE8.

    Server Error in '/' Application. 
    -------------------------------------------------------------------------------- 
     
    Out of memory.  
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.  
     
    Exception Details: System.OutOfMemoryException: Out of memory. 
     
    Source Error:  
     
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.   
     
    Stack Trace:  
     
     
    [OutOfMemoryException: Out of memory.] 
       System.Drawing.Graphics.CheckErrorStatus(Int32 status) +1048473 
       System.Drawing.Graphics.DrawImage(Image image, Int32 x, Int32 y, Int32 width, Int32 height) +98 
       Telerik.Web.UI.BinaryImageTransformationFilter.CropImage(Image img, Int32 scaledHeight, Int32 scaledWidth) +227 
       Telerik.Web.UI.BinaryImageTransformationFilter.ProcessImageInternal(Byte[] image) +228 
       Telerik.Web.UI.BinaryImageTransformationFilter.ProcessImage(Byte[] image) +17 
       Telerik.Web.UI.BinaryImageFilterProcessor.ProcessFilters(Byte[] imageData) +62 
       Telerik.Web.UI.RadBinaryImage.ProcessImageData() +50 
       Telerik.Web.UI.RadBinaryImage.OnPreRender(EventArgs e) +20 
       System.Web.UI.Control.PreRenderRecursiveInternal() +80 
       System.Web.UI.Control.PreRenderRecursiveInternal() +171 
       System.Web.UI.Control.PreRenderRecursiveInternal() +171 
       System.Web.UI.Control.PreRenderRecursiveInternal() +171 
       System.Web.UI.Control.PreRenderRecursiveInternal() +171 
       System.Web.UI.Control.PreRenderRecursiveInternal() +171 
       System.Web.UI.Control.PreRenderRecursiveInternal() +171 
       System.Web.UI.Control.PreRenderRecursiveInternal() +171 
       System.Web.UI.Control.PreRenderRecursiveInternal() +171 
       System.Web.UI.Control.PreRenderRecursiveInternal() +171 
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842 
     
      
     

    I've noticed in your internal builds that you fixed an error caused by RadBinaryImage when ResizeMode="Fit". I was wondering if this is the same error, but is being caused by ResizeMode="Crop".

    If you could tell me if this is a RadBinaryImage error or is it being caused by something else like my server.

    Thanks.

  2. Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 02 Oct 2009 Link to this post

    Hi,

    I'm afraid that such behavior was not reported to us previously and I'm unable to recreate it locally (please check the attached sample project). Therefore it will be appreciated if you could give us some additional information about your case i.e. are you using large images and how many images are loaded simultaneously. You should have in mind that loading large amount of big images will consume more server resources and should be avoided.

    Regards,
    Rosen
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. robertw102
    robertw102 avatar
    265 posts
    Member since:
    Jul 2007

    Posted 02 Oct 2009 Link to this post

    The majority of the images are around 3264px × 2448px in size, but under 5MB. The number of images being shown currently is about 5 images per rotator (7 currently), so around 30 images are being shown now.

    I can display them without resizing using the RadBinaryImage control without any errors from occurring. So is it because the image size is 3264px × 2448px that it's causing the error to be thrown or is it how many images I'm loading at a time?

    Thanks.
  5. Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 06 Oct 2009 Link to this post

    Hi,

    As I pointed in my previous message you should avoid loading such large amount of data. A rough calculation of the described data will indicate that with a single request you are loading up to 150MB of data into memory and you should have in mind that event more memory will be consumed  for its processing, which eventually will lead to scalability issues.

    Therefore I suggest you to consider limiting the number of images loaded simultaneously and/or using an already resized copy of the images (which will remove the additional load from the servers CPUs too).

    Regards,
    Rosen
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  6. robertw102
    robertw102 avatar
    265 posts
    Member since:
    Jul 2007

    Posted 15 Oct 2009 Link to this post

    I understand the memory cost I may experience by loading this amount of images, but the error only starting occurring when I set the ResizeMode to Crop. If I don't resize the image, everything works fine and the error never shows.

    Also, shouldn't resizing the image reduce the size of the image stored in the cache or is the RadBinaryImage storing the original one instead of the resized one in the cache?
  7. BaiH
    BaiH avatar
    83 posts
    Member since:
    Aug 2008

    Posted 21 Oct 2009 Link to this post

    I'm not an expert on BinaryImageControl but lets think on this for a second. In order image data to be processed either cropped or fitted or whatever modification to be made to it, it should be loaded in-memory and loading the mentioned amount of data in the server's memory surly can lead to out-of-memory exception. And as you may guess usually it will be much harder to get the exception when the image data is just streamed and no processing is done.

    Also I'm sure that the image stored temporary in the cache is the processed one not the original.

    --BH
  8. Marco
    Marco avatar
    25 posts
    Member since:
    Oct 2010

    Posted 31 Dec 2011 Link to this post

    Baih,

    We had the same problem, investigated on de server and the w3wp.exe was taking a lot of memory.
    Differences with a server running ok en this one the only thing we have found was the AppPool the option for Enable 32-Bit Applications = False
    We set it to true and for now everything runs fine.

    Hope this helps

    Regards Marco
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017