
Project Snowflake: Non-blocking safe manual memory management in .NET - ingve
https://www.microsoft.com/en-us/research/publication/project-snowflake-non-blocking-safe-manual-memory-management-net/#
======
scott_s
This work was also published in PLDI as "Simple, Fast and Safe Manual Memory
Management" ([https://www.microsoft.com/en-us/research/wp-
content/uploads/...](https://www.microsoft.com/en-us/research/wp-
content/uploads/2017/03/kedia2017mem.pdf)). The presentation from the
conference is also online:
[https://www.youtube.com/watch?v=C07s5LTuTmE](https://www.youtube.com/watch?v=C07s5LTuTmE)

~~~
algorithmsRcool
No, this is a different paper and a different technique.

This paper cites "Simple, fast and safe..." in section 7 and explains the
differences.

------
CyanLite2
Freaking awesome! So... the inevitable question... will this get merged into
CoreCLR and become mainstream?

~~~
runevault
I would be surprised if MS wasn't intending to merge this in if it pans out
the way they hope it will. Why else invest the resources to try and make it?

I know as someone who slings c# for the day job I'm super excited to try it
out.

~~~
sebazzz
True, there are many research projects of Microsoft which ended up in
production. Take the Linux Subsystem for Windows (Bash) for instance, or a
little closer to home: Code contracts.

~~~
MrZipf
The Linux Subsystem for Windows isn't a great example. Folks in MSR Cambridge
had Linux running on Windows circa Y2K. The Linux Subsystem today comes from a
second effort using Drawbridge.

------
crudbug
Great work - +1 CLR vs JVM battle. Hoping this will get merged with CoreCLR
soon. Any info on this ?

------
speps
Does anyone know of a game engine that uses CoreCLR instead of Mono (like in
Unity)?

~~~
mellinoe
I've written an amateur, hobby-level engine, described here:
[https://mellinoe.wordpress.com/2017/01/18/net-core-game-
engi...](https://mellinoe.wordpress.com/2017/01/18/net-core-game-engine/).
This was more of a personal exercise for learning and experimenting than a
serious attempt at game design, so the engine isn't that advanced.

For something more professional and polished, there is Xenko, which runs on
CoreCLR for some of its non-mobile targets.
[https://xenko.com/](https://xenko.com/)

Also, Unity itself doesn't really run on Mono -- it just has a scripting layer
that hosts Mono on top of its C++ core. Perhaps not a useful distinction for
you, but I thought I'd mention it.

(Note: I work on .NET Core at Microsoft)

~~~
CMay
Do you know if this memory management work might also make it into .NET
Native?

~~~
mellinoe
I don't know. From what I understand, this is still just a research project,
and not something we have immediate plans to integrate into .NET Core. If we
did that, though, I don't see why .NET Native wouldn't be considered as well.

------
ppog
It seems like this relies for some of its safety guarantees on checks in
(their fork of) the C# compiler. For example, owner non-copy guarantees seem
to be enforced at the C# front end level rather than in the CLR. That could
cause problems for getting it into CoreCLR (and much more so the desktop CLR),
as this is meant to support multiple languages; relying on a specific language
front-end for safe use of a feature feels at odds with the 'common language
runtime' philosophy... It would be great to see it though!

------
roskilli
What I wouldn't give to have this in Go. Literally have been playing with Mmap
system calls recreating something similar with mixed results...

------
teddyuk
Am I reading it right?

If you want to manage the memory allocation yourself you can.

Why not just pre-allocate a lost of objects and re-use / free those?

Think I'm missing something

~~~
Rusky
It's a particular technique for managing the memory that helps you avoid
accidentally using it after it's been freed/reused.

~~~
naasking
And you don't incur tracing overhead for objects in the manual heap. Reused
objects from the GC still incur this cost.

