On Fri, Jan 31, 2020 at 2:48 AM <pierre.cu...@gmail.com> wrote:
>
> Is there a better way to estimate the memory usage of a map, other than the 
> following:
> https://play.golang.org/p/MLSd84CJB3R

The memory usage of a map is going to depend on the history of how the
map is used.

That said, a map is an array of buckets.  Each bucket holds 8 keys and
8 values.  The buckets will normally be more than half full on
average, though that will depend on the exact history of additions and
deletions.  You can use that information to roughly estimate the
memory usage of a map given the key size, the value size, and the
number of entries.

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcV-hQBjWBW%2BdE4taFqYEe9X8tMeqP69nZd-8L6f0%2BJrXw%40mail.gmail.com.

Reply via email to