Garbage collection fails to reclaim BitmapImage?

前端 未结 5 1399
被撕碎了的回忆
被撕碎了的回忆 2020-12-11 05:10

I have an application(WPF) which creates BitmapImages in huge numbers(like 25000). Seems like framework uses some internal logic so after creation there are approx 300 mb of

5条回答
  •  情深已故
    2020-12-11 06:08

    This is still an array

    BitmapImage[] bimages = new BitmapImage[size];
    

    Arrays are continuous fixed-length data structures, once memory allocated for the whole array you cannot reclaim parts of it. Try using another data structures (like LinkedList) or other more appropriate in your case

提交回复
热议问题