Re: OutOfMemoryException is thrown




"Carlos" <Carlos@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:36BA829F-C7CB-45DB-9612-5AC307D6DF09@xxxxxxxxxxxxxxxx
>
> I have a process which is running a remoting object.
> This object reads messages from a MSMQ queue. Each message is a dataset
> and it is stored in a Oracle10 Database. (Messages in the queue are stored
> as strings)
> After start, the process uses 30-40MB of memory (in the taskmanager).
> Two or three days later, the memory used by the process is about 550MB and
> then
> an OutOfMemoryException is thrown.
> I've tried with the native Oracle Data PRovider, the .Net Oracle Provider
> and ODBC.
> I also call the GC.Collect() method every hour.
> I'm not using unsafe code.
>
> Any ideas??
>
> thanks in advance...
>
> Carlos

Check with perfmon where the memory goes ;-), the "CLR memory" gen0 .. 2 and
Harge Object Heap counters shows you the managed heap consumption, while
"process" - private bytes tells you about both managed and native heap
consumption (the managed heap itself is a native heap).

If it happens that your gen2 counter grows and doesn't shrink when a full
collection occurs, you have to inspect your code as you are keeping object
references alive (places to look at are arrays, arraylist and collections).
If the LOH grows (containing objects > 85 Kb) it means that - or you are
holding LOH references, or the LOH is getting fragmented, in the latter case
there is only one thing you can do - shutdown the service (or application
domain) and restart.

If your gen 0 ..2 counters show a normal allocation pattern (that is
growing/shrinking), but private bytes keep growing, you have a unmanaged
leak (note that you always call unmanaged code, be indirectly or directly).

Willy.




.



Relevant Pages

  • RE: unmanaged vs managed.
    ... I couldnt imaging tormenting the managed heap with that kind of through ... I would rather use structure pointers to a chunk of fixed memory. ... If I put all, say, 5000+ records on the heap individualy, then the heap has ... fixedor pinning via GCHandle. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: What does a heap look like?
    ... But the original post didn't appear to be, in fact it asked how the CLR ... managed heap was different from the usual heap. ... I was describing a managed heap to answer that question. ... can be in global memory, the stack, or the native heap depending on how ...
    (microsoft.public.dotnet.framework.clr)
  • Re: What does a heap look like?
    ... But the original post didn't appear to be, in fact it asked how the CLR managed heap was different from the usual heap. ... And certainly the CLR's managed heap is NOT a Win32 heap owned and operated by the CLR, it is a different beast entirely. ... can be in global memory, the stack, or the native heap depending on how you create them. ...
    (microsoft.public.dotnet.framework.clr)
  • Re: why is the stack faster?
    ... The managed heap also uses a pointer to indicate were ... > lock mechanism being used to ensure thread safety of the information used ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: GC performance - GC fragility
    ... Think of a native heap which has ... I haven't tested FMM regarding heap fragmentation. ... You seem to have more clue than I have and since I haven't studied FastMM source code could you shed some light on the problem how a native heap can prevent fragmentation, ...
    (borland.public.delphi.non-technical)

Quantcast