Live data from Hacker News

Show HN: Micro-mitten – Research language with compile-time memory management

github.com

1–10 of 68 posts

Show HN: Micro-mitten – Research language with compile-time memory management

#1
I've been working on implementing the compile-time approach to memory management described in this thesis (https://www.cl.cam.ac.uk/techreports/UCAM-CL-TR-908.pdf) for some time now - some of the performance results look promising! (Although some less so...) I think it would be great to see this taken further and built into a more complete functional language.

Show HN: Micro-mitten – Research language with compile-time memory management
github.com

Re: Show HN: Micro-mitten – Research language with compile-time memory management

#2
> This means that it maintains the ability to insert freeing code at appropriate program points, without putting restrictions on how you write your code.

How does the approach in mitten compare to Automatic Reference Counting in Objective-C (and I think Swift too)? From my experience, ARC can still add a surprising amount of memory management overhead to a program and needs a lot of hand-holding to keep that overhead down to an acceptable level (e.g. low single-digit percentage of overall execution time in programs that talk to Obj-C APIs a lot). I would be surprised if a "traditional GC" can do any worse in that regard (maybe reference counting smears the overhead over a wider area, e.g. no obvious spikes, but instead "death by a thousand cuts").

One thing I'd like to see in modern languages is to encourage and simplify working with an (almost) entirely static memory layout, and make manipulations inside this static memory layout safe. This static memory layout doesn't need to be magically derived by the compiler as long as the language offers features to easily describe this memory layout upfront.

A lot of data structures in applications don't need to live in "short-lived" memory regions, but they often do because that's what today's languages either encourage (e.g. when built on the OOP philosophy), or what happens under the hood without much control from the code (e.g. in "reference-heavy" languages like Javascript, Java or C# - or even "modern C++" if you do memory management via smart pointers).

Minimizing data with dynamic lifetime, and maximing data with static lifetime could mean less complexity in the language and runtime (e.g. lifetime tracking by the compiler, or runtime memory management mechanisms like refcounting or GCs).

Re: Show HN: Micro-mitten – Research language with compile-time memory management

#3

> This means that it maintains the ability to insert freeing code at appropriate program points, without putting restrictions on how you write your code. How does the approach in mitten compare to Automatic Reference Counting in Objective-C (and I think Swift too)? From my experience, ARC can still add a surprising amount of memory management overhead to a program and needs a lot of hand-holding to keep that overhead…

From what I understood, it’s not reference counting but trying to determine at compile time when to drop using data flow analysis to come up with an approximation of the liveness.

I had a thought sometimes back, can compilers do a profile run to get information about the liveness of objects it couldn’t determine statically by dumping gc info?

Re: Show HN: Micro-mitten – Research language with compile-time memory management

#4
It's refreshing to see new approaches for memory management exploring notably the power of static analysis at compile time. I will take the time to read this dissertation!

Just a question. It reminds me previous works on static inference of stack-allocated regions. What are the relationships, if any?

* [A Simplified Account of Region Inference](https://hal.inria.fr/file/index/docid/72527/filename/RR-4104...)

* [MLton regions](http://mlton.org/Regions)

Re: Show HN: Micro-mitten – Research language with compile-time memory management

#5
post #3

> This means that it maintains the ability to insert freeing code at appropriate program points, without putting restrictions on how you write your code. How does the approach in mitten compare to Automatic Reference Counting in Objective-C (and I think Swift too)? From my experience, ARC can still add a surprising amount of memory management overhead to a program and needs a lot of hand-holding to keep that overhead…

From what I understood, it’s not reference counting but trying to determine at compile time when to drop using data flow analysis to come up with an approximation of the liveness. I had a thought sometimes back, can compilers do a profile run to get information about the liveness of objects it couldn’t determine statically by dumping gc info?

Most programs are complex, have lots of branching, so this wouldn't work.

Re: Show HN: Micro-mitten – Research language with compile-time memory management

#7
post #4

It's refreshing to see new approaches for memory management exploring notably the power of static analysis at compile time. I will take the time to read this dissertation! Just a question. It reminds me previous works on static inference of stack-allocated regions. What are the relationships, if any? * [A Simplified Account of Region Inference]( https://hal.inria.fr/file/index/docid/72527/filename/RR-4104... ) * [MLt…

The GitHub readme links to a scholarly thesis discussing the general approach[0], as well as to the author's own dissertation[1] on this specific project (which "aims to investigate the practical viability" of [0] "by building the technology into a real compiler" for empirical evaluation on real-world hardware). Region inference is discussed throughout [0], and extensively in Chapter 9.

[0] https://www.cl.cam.ac.uk/techreports/UCAM-CL-TR-908.pdf

[1] http://nathancorbyn.com/nc513.pdf

Re: Show HN: Micro-mitten – Research language with compile-time memory management

#8
post #4

It's refreshing to see new approaches for memory management exploring notably the power of static analysis at compile time. I will take the time to read this dissertation! Just a question. It reminds me previous works on static inference of stack-allocated regions. What are the relationships, if any? * [A Simplified Account of Region Inference]( https://hal.inria.fr/file/index/docid/72527/filename/RR-4104... ) * [MLt…

The GitHub readme links to a scholarly thesis discussing the general approach[0], as well as to the author's own dissertation[1] on this specific project (which "aims to investigate the practical viability" of [0] "by building the technology into a real compiler" for empirical evaluation on real-world hardware). Region inference is discussed throughout [0], and extensively in Chapter 9. [0] https://www.cl.cam.ac.uk/t…

If the paper is anything like the abstract, this will be wonderful!

Re: Show HN: Micro-mitten – Research language with compile-time memory management

#9
"In its current form, asap is not equipped to handle CONCURRENT programs. Managing memory in concurrent programs poses its own set of challenges."

So it's doesn't have the fearless concurrency of Rust yet and I wonder if it's possible this approach at all. I guess it's an open research question.

Re: Show HN: Micro-mitten – Research language with compile-time memory management

#10
post #3

Earlier quoted context omitted.

From what I understood, it’s not reference counting but trying to determine at compile time when to drop using data flow analysis to come up with an approximation of the liveness. I had a thought sometimes back, can compilers do a profile run to get information about the liveness of objects it couldn’t determine statically by dumping gc info?

Most programs are complex, have lots of branching, so this wouldn't work.

[deleted]
Post reply on HN