suicao / aforge

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

UnmanagedImage should call AddMemoryPressure and RemoveMemoryPressure #337

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
UnmanagedImage allocates unmanaged memory in several situations.

An UnmanagedImage that is never explicitly disposed of, will be garbage 
collected and have its finalizer called, thus freeing the unmanaged memory.

In such a scenario, it is recommended to call System.GC.AddMemoryPressure and 
System.GC.RemoveMemoryPressure to inform the garbage collector of the amount of 
unmanaged memory allocated, so that it can be taken into account when 
scheduling garbage collection.

I have attached a patch where I have made that change.

http://msdn.microsoft.com/en-us/library/system.gc.addmemorypressure.aspx
http://msdn.microsoft.com/en-us/library/system.gc.removememorypressure.aspx

Original issue reported on code.google.com by ncruces on 20 Mar 2013 at 1:35

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by andrew.k...@gmail.com on 20 Mar 2013 at 1:39

GoogleCodeExporter commented 9 years ago
Added usage System.GC.RemoveMemoryPressurу()/AddMemoryPressure() to 
UnmanagedImage allocate/deallocation code.

Fixed in revision 1712.

Original comment by andrew.k...@gmail.com on 26 Jun 2013 at 9:23

GoogleCodeExporter commented 9 years ago

Original comment by andrew.k...@gmail.com on 26 Jun 2013 at 9:39

GoogleCodeExporter commented 9 years ago

Original comment by andrew.k...@gmail.com on 16 Jul 2013 at 9:54