Unable to consume Heap reserved memory

  • Thread starter Aravindakumar Venugopalan
  • Start date
A

Aravindakumar Venugopalan

Hi ,
A Windows form application which interacting with the unmanaged C++
codes . In unmanaged c++ code we allocate around 130MB on the heap for
annalysing high resolution images .

Earlier during the processing ee do lot of process on the image and the
memory reaches high at one point of time to 1.2GB , after that we clear
all the memory being used so the memory in the task manager comes to
really low.
Also I am calling CompactHeap function in the c++ to get contigous
memory space.

Then when we read the processed high resolution image (130MB ) it is
going to out of memory exception . At this point I run memory analyser
and analysed the process memory , the reserved memory in the process is
good enough and the free memory in the process is really low . I am
wondering why the system is not taking the memory from the reserved
memory space.

Regards
Aravind.
 
H

Hector Obregon [eMVP]

Hi,

Maybe some code that shows how you do the managed/unmanaged code interaction
would help diagnose the problem.

Hector
 
A

Aravindakumar Venugopalan

Thanks for your reply,

The unmanaged / managed is through usual interop servies ,
Actually the problem is not occuring when I donot process the image that
fills and after clears the memory . Once I process the image that
consumes and clears the memory , disposed memory goes to the reserved
memory , after that if i allocate memory on the heap of 130MB for the
image it leads to out of memory exception .

I am wondering how to clear the reserved memory and make it as free
memory that the process can use for alloting when i say CALLOC ( 130 MB
), will the heap manager takes care of that.

Regards
Aravind.
 
W

Willy Denoyette [MVP]

Mind to tell us what CompactHeap really is?
I'm also not sure what you mean with this ...
after that we clear
all the memory being used so the memory in the task manager comes to
really low.

What exactly do you mean with "clear the memory" and what exactly you are
looking at in taskman?
I would suggest you take a look at the memory consumption using perfmon,
herewith you can inspect managed heap (CLR memory counters) and non managed
heap memory (process counters).
I would also suggest you read about memory management and GC heap management
in windows application.



Willy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top