runtime: Memory leaking with Serializing JSON on Large Objects

now there is Memory leaks with JsonSerializer.Serialize when i convert list of objects, the memory increases from 950 MB to 2.5 GB.

var list = JsonSerializer.Serialize(MainWindowViewModel.Tabs, options);
File.WriteAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "products.json"), list);
GC.Collect();

before JsonSerializer.Serialize image after JsonSerializer.Serialize image

i test with .NET 7.0.0-rc.2.22451.11 my OS is Windows 11 the app is X86

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 31 (15 by maintainers)

Most upvoted comments

it’s better than JSON.NET now.