Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
GitHub or Developer Community with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
We have observed a strange behavior while developing for iOS. Creating empty dictionaries results in a huge memory usage, something that does not happen on Windows platforms. For example creating 60000 Guid-float dictionaries result in 30MB memory usage, which is a critical amount on a mobile platform. The same takes up 800kb of memory in a Windows 8.1 Store app.
### Steps to Reproduce:
>Dictionary<Guid, float> dicts = new Dictionary<Guid, float>;
>for (int i = 0; i < 50000; i++)
> dicts[i] = new Dictionary<Guid, float>(0);
It appears that unlike CLR, Mono initializes the dictionary with a size of 12, which results in an additional size of 12*(16+8) per dictionary.
### Actual Results:
~30 MB of memory used on iOS
### Expected Results:
Similar memory profile as shown on Windows (~800 kb)
### Build Date & Platform:
Fixed in master
Mono after 3.6
It still allocates an array with the size of 1. Microsoft's implementation doesn't allocate the array at all:
@Adam: we're now using Microsoft's implementation of Dictionary<T>: https://github.com/mono/mono/commit/346894957c49a9c839236e0fc0296e4e3d44e10b
Oh, you cannot possibly imagine how happy I am to hear that :)
Is it part of MDK 18.104.22.168 (the latest on the alpha channel)? If not, any estimates when this will hit the alpha channel?
It's not in 3.12. I imagine it'll be in 3.14, though I don't have an ETA for that.