vrosnet / aforge

Automatically exported from code.google.com/p/aforge
Other
0 stars 1 forks source link

Memory leak in AVIWriter #51

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create an AVIWriter (in my case "DIB " codec, 640 w, 480 h, 10 fps)
2. Continuously call 'AddFrame'
3. Watch 'Physical Memory Usage History' in windows task manager.

What is the expected output? What do you see instead?

Expected output would be that memory usage remains stable.  Actual output
is that physical memory usage grows to utilize all system memory. 
SOMETIMES the situation will correct itself just before system runs out of
memory but SOMETIMES system runs out of memory and application throw s an
'Out of memory' exception.

What version of the product are you using? On what operating system?

AFORGE 1.6.  VS.NET 2008 Console Application targetting .NET Framework 3.5
 Windows Vista Ultimate Edition

Please provide any additional information below.

Workaround: I discovered that if I create a system.timers.timer with an
interval of 60000 (60 seconds) and call GC.Collect() on the Timer.Elapsed
event, the memory is freed.

Original issue reported on code.google.com by bravenes...@gmail.com on 23 Feb 2008 at 4:50

GoogleCodeExporter commented 8 years ago
There is no memory leak in AVIWriter::AddFrame() method. The memory leak is in 
your 
application. Check your application - it is the most probable source of the 
issue.

I believe you just create Bitmap objects and you don't call Dispose() method 
for 
them. AVIWriter of course is not going to clean it as well: your image - your 
responsibility.

The fact that calling Garbage Collector helps also points that most probably 
the 
issue is caused by omitting Dispose() call.

Original comment by andrew.k...@gmail.com on 23 Feb 2008 at 6:51