Skip to content

.NET Meetup annotations 2  #1

@kidchenko

Description

@kidchenko

If you run a console app, you get an instance of AppDomain it 'kind of' a process in the native level. If you run your app again you get a second console app running, then you have another app domain.

ASP .NET has a different idea, you can have multiple app domains for the same application. This become important when you are working with statics.

A static class is nothing but an instance of a Type (the Type class from the .NET) of your type.

Static are passed by value and by reference - respecting the rule of each type.

Strings are immutable in .NET. What does it means?

What it means to a memory model perspective?

image

Strings in the heap

  • The first 4 bytes are the header
  • The next 4 bytes is the length of the string
  • Then we have the value of string
  • The characters are allocated similar to an array - they are contiguous

image

image

If you concat a string an other string is created. As the image above the s1 will point for the new string, but s2 still pointing for the old string.

Exploring NET's Memory Management — A Trip Down Memory Lane

image

image

GC implementation .NET Core

https://raw.githubusercontent.com/dotnet/coreclr/master/src/gc/gc.cpp

https://github.com/dotnet/coreclr/blob/master/Documentation/botr/garbage-collection.md

image.

https://img.memecdn.com/do-you-work-like-this_o_7136157.jpg

https://github.com/maartenba/memory-demos/tree/master/TripDownMemoryLane/TripDownMemoryLane/Demo01

https://www.youtube.com/watch?v=9FEfy9y0fFQ

https://youtu.be/9FEfy9y0fFQ

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions