modern-go / reflect2

reflect api without runtime reflect.Value cost
Apache License 2.0
758 stars 73 forks source link

unsafe_map.UnsafeSetIndex cost much memory #3

Closed 995270418L closed 6 years ago

995270418L commented 6 years ago

When i deserialized a json string, it size is about 40KB. and in benchmark case , I found the UnsafeSetIndex method cost much memory, it's about 40% memory, and the gc can't collection immediately. and this problem trouble me a lot

995270418L commented 6 years ago

the json deseriazed framework is json-iterator, and it use reflect2 to map json to interface{}, and in my scenes, the interface type actually is map[string]map[string]interface{}

taowen commented 6 years ago

can you provide a benchmark to reproduce the case? do you have a rough idea on why gc is not collecting it immediately. Or is it collected eventually? If memory actually leaked, we can produce the issue reliably by running it over and over again.

995270418L commented 6 years ago

I find this problem is relation with go , i will close this issue. sorry