Re: Memory increases linearly

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




"Faisal" <faisalm83@xxxxxxxxx> ha scritto nel messaggio
news:ce8b9136-0248-42f0-be5c-f6d31b390429@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

I've a strange problem with my application. After a few minutes
working, my applications memory usage and VM size( shown in Task
Manager) increases very rapidly(say 3MB per sec). With in a few
minute it reaches maximum and application hangs. The application is a
real time data acquisition tool which allocated and deleted memory
continuously.

Hi,

I think you should pay attention to your memory management code.

You showed no code here, so it is hard to help on a "concrete" basis...

However, I would suggest to pay attention to how you release code.
Do you use smart pointers like shared_ptr?
Or do you have circular dependencies, so allocated stuff can't be released?

Do you properly use destructors and implement a RAII paradigma in your code?

If you have base classes, did you define their destructors as *virtual* ?

You may also want to implement a custom memory allocator (e.g. you can do
that also for STL containers like std::vector, you can override the default
allocator behaviour for STL containers; or you can overload new, etc.) if
you have particular needs.

I'm sorry I can't give better help without reading some code.

HTH,
Giovanni



.



Relevant Pages