dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.47k stars 4.77k forks source link

Reduce CoreCLR memory footprint #8718

Open kvochko opened 7 years ago

kvochko commented 7 years ago

We are currently working on minimizing memory footprint of CoreCLR. Our common scenario is a mobile Xamarin.Forms application for Tizen, test cases can be found here. One of the areas we are looking at is the garbage collector. We have tried several things and found that, for example, setting g_bLowMemoryFromHost to 1 and ephemeral budget to a fixed small value reduces the peak private dirty memory by up to ~1200K.


Application         | Original peak      | Modified peak      | Difference
                    | Private_Dirty, Kb  | Private_Dirty, Kb  |

HelloWorld          | 14744              | 13588              | 1156
ApplicationStoreUI  | 14816              | 14668              | 148
GalleryUI           | 46456              | 46264              | 192
SNSUI               | 21872              | 21724              | 148
Calculator          | 17944              | 17588              | 356

Application         | Original startup   | Modified startup   | Difference
                    | CPU time (jiffies) | CPU time (jiffies) |

HelloWorld          | 135                | 146                | 11
ApplicationStoreUI  | 192                | 192                | 0
GalleryUI           | 251                | 259                | 8
SNSUI               | 447                | 452                | 5
Calculator          | 290                | 295                | 5

As discussed previously, exposing knobs like these as runtime configuration options is not desirable. What would be the best way to implement such changes? There seems to be a concept of performance scenarios, but it's not clear if this code is used anywhere, and if so - how to use it, and it's still a question whether it is the right place to implement such changes. Any help is greatly appreciated.

@Maoni0 @swgillespie CC @ruben-ayrapetyan @gbalykov @Dmitri-Botcharnikov

Maoni0 commented 2 years ago

we can, but we'd need perf data. to begin with, collect a top level trace. described here. if it doesn't get you to the right section (sometimes it doesn't and I dunno why) you can search for "how to collect" in the doc.

NinoFloris commented 2 months ago

Can we conclude DATAS (https://learn.microsoft.com/en-us/dotnet/standard/garbage-collection/datas) has solved this problem sufficiently and close the issue?