none
Out of memory due to sudden spike in memory usage RRS feed

  • Question

  • Hi,

    I'm facing a sporadic OOM exception.

    Here's my system, OS, .Net spec.

    System: Intel Quad Core Dual Processor 32 bit 4GB RAM

    OS: XP Professional SP3

    .Net: v3

    Problem: This is a high memory usage application that processes images. To avoid OOM due to fragmentation, we have resorted to using static buffers which will be kept during the life of the application. Still we see a tremendous spike in memory usage at some point (random) and the application fails with OOM afterwards.

    I have uploaded the screenshots from perfmon logs, and windbg dumps here

    http://picasaweb.google.com/musthafa.manikkoth/MemUsageShot#

     

    My questions: Looking at the perfmon logs and eeheap outs puts, can anyone tell if this is due to native leak, or managed leak, or managed heap fragmentation or virtual memory fragmentation? If this turns out to be a virtual memory fragmentation, what is a fix for this?

    Thanks,

    Musthafa

     

     

     

     


    Hard Core Soft Ware
    Tuesday, April 6, 2010 8:31 PM

Answers

  • If you see a lot of free space then it is Heap Fragmentation. How often do you see GEN 2 collections? If they are often ,they you could probably have issue.For CPU Spikes, What the % time spent on GC?

    And to avoid Fragmentation in LOH pre-allocate objects and Pin them , like example if you are using byte arrays for using in stream another example if you are creating a million objects in a Dictionary then you should pre-allocate them via the constructor . 

    And if you are application is spending high percentage time on GC then it could be because of frequent allocations in LOH. Here is an post to Identify the cause of actual allocations.

     

     


    Thanks Naveen http://naveensrinivasan.com
    • Marked as answer by SamAgain Friday, April 16, 2010 9:44 AM
    Wednesday, April 7, 2010 12:17 AM
  • Hi Musthafa Manikkoth,

    some pictures you uploaded are hardly to see clearly. However, I have an advice on this issue.

    If you want to know which part of your application caused the memory leak, you can use a tool named CLRProfile.

    By this tool, you can know whether the managed part of your application caused the memory leak. If it's you can see clearly which managed part of your application leads to this situation. If not, at least this tool can help you reduce the scope of your problem.

    Hope it helpful to you. And have a nice day.

    Thanks,

    Tracy

    • Marked as answer by SamAgain Friday, April 16, 2010 9:44 AM
    Wednesday, April 7, 2010 1:43 AM

All replies

  • If you see a lot of free space then it is Heap Fragmentation. How often do you see GEN 2 collections? If they are often ,they you could probably have issue.For CPU Spikes, What the % time spent on GC?

    And to avoid Fragmentation in LOH pre-allocate objects and Pin them , like example if you are using byte arrays for using in stream another example if you are creating a million objects in a Dictionary then you should pre-allocate them via the constructor . 

    And if you are application is spending high percentage time on GC then it could be because of frequent allocations in LOH. Here is an post to Identify the cause of actual allocations.

     

     


    Thanks Naveen http://naveensrinivasan.com
    • Marked as answer by SamAgain Friday, April 16, 2010 9:44 AM
    Wednesday, April 7, 2010 12:17 AM
  • Hi Musthafa Manikkoth,

    some pictures you uploaded are hardly to see clearly. However, I have an advice on this issue.

    If you want to know which part of your application caused the memory leak, you can use a tool named CLRProfile.

    By this tool, you can know whether the managed part of your application caused the memory leak. If it's you can see clearly which managed part of your application leads to this situation. If not, at least this tool can help you reduce the scope of your problem.

    Hope it helpful to you. And have a nice day.

    Thanks,

    Tracy

    • Marked as answer by SamAgain Friday, April 16, 2010 9:44 AM
    Wednesday, April 7, 2010 1:43 AM