.NET Garbage Collector mystery

后端 未结 4 837
無奈伤痛
無奈伤痛 2021-01-30 22:42

In my job we had a problem with OutOfMemoryExceptions. I\'ve written a simple piece of code to mimic some behavior, and I\'ve ended up with the following mystery. Look at this s

4条回答
  •  耶瑟儿~
    2021-01-30 23:10

    I had similar problem in .NET with the difference my byte[] had random sizes.

    i tried two ways:

    • write an own heap manager (alloc memory with one large buffer and just adjust pointers)

    • use a memory mapped file (in my opinion the better solution)

    If possible you can try out .NET 4.5 http://blogs.msdn.com/b/dotnet/archive/2012/07/20/the-net-framework-4-5-includes-new-garbage-collector-enhancements-for-client-and-server-apps.aspx

提交回复
热议问题