Рет қаралды 58
This talk will explore the application of the upcoming GHC language extension LinearTypes to manage references to values in a foreign language.
Our case study will be inline-java, a library that enables embedding Java code in Haskell modules and integrates the JVM and Haskell runtimes. Managing references to objects in the Java heap has been error-prone, with the programmer responsible for timely deletion of these references. Deleting too soon leads to use-after-free errors, while deleting too late results in intermittent OutOfMemory errors from the JVM. Forgetting to delete some references causes the application's memory to grow steadily over time without an obvious cause.
We will demonstrate how linear types involve the compiler in verifying that a program disposes of references to foreign values in a timely manner, effectively eliminating the most common bugs related to this issue.