Jorge L Fernandez
How to release managed memory in C#
By Jorge L Fernandez in .NET on Jul 14 2008
  • jiya baraiya
    Jul, 2008 29

    garbage collect

    • 0
  • Jorge L Fernandez
    Jul, 2008 16

    I got into the AppDomain benefits an implemented another solution to the initial problem; - Create an AppDomain. - Executing the Assembly into the created domain. - Unload the domain. Both solutions are equivalent in terms of performance and memory. Anyways, if some other approach are possible I will appreciate your comments.

    • 0
  • Jorge L Fernandez
    Jul, 2008 16

    I realized that my problem was that many Bitmap object were created through the process. I invoked the GC.Collect method but this was causing a performance impact. Then I start looking for a solution to release by my self those Bitmap. Bitmap are created in the managed heap which is not intended to be accessed directly by the user (coder), so, the solution I found was not elegant but solved my problem with no performance impact. I created a separated program that creates the Bitmaps and is called by the main program by using the Process class. When this separated program starts it does its work and then when is closed its occupied memory is released avoiding the OutOfMemoryException. If you have any suggestion or any other solution I will appreciate your response.

    • 0
  • Jorge L Fernandez
    Jul, 2008 14

    Hi, I'm creating a big amount of images at runtime (thousands) and I'm getting and OutOfMemory Exception. I have detected in my code where the problem is and it's an array of bytes that is being created many times and allocating memory until the GC do its work. How do I explicitly can free that byte array in order to avoid calling GC.Collect method? Thanks in advanced

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS