3 ms·
> Predictable latency if desired (optional GC) Does Scala Native support not using a GC? It seems like it would be difficult to get Scala working without a GC.
by wtetzner 10y ago
> Predictable latency if desired (optional GC)
Does Scala Native support not using a GC? It seems like it would be difficult to get Scala working without a GC.
- Recurecur 10y agoIt supports direct allocation via both the heap and the stack. type Vec = CStruct3[Double, Double, Double] val vec = stackalloc[Vec] // allocate c struct on stack !vec._1 = 10.0 // initialize fields !vec._2 = 20.0 !vec._3 = 30.0 length(vec) // pass by reference ...and... @extern object stdlib { def malloc(size: CSize): Ptr[Byte] = extern } val ptr = stdlib.malloc(32) http://www.scala-native.org/en/latest/ http://www.scala-native.org/en/latest/ Otherwise it currently uses the Boehm GC. One big area that needs more work: "Scala Native doesn’t yet provide libraries for parallel multi-threaded programming and assumes single-threaded execution by default."