Skip to content
This repository has been archived by the owner on Feb 23, 2018. It is now read-only.

Commit

Permalink
fixed deprecated number syntax
Browse files Browse the repository at this point in the history
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@26061 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
  • Loading branch information
michelou committed Nov 23, 2011
1 parent e0f0411 commit e41184f
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions src/compiler/scala/tools/ant/sabbus/Compilers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,35 @@ package scala.tools.ant.sabbus
import java.net.URL

object Compilers extends collection.DefaultMap[String, Compiler] {

val debug = false

private val container = new collection.mutable.HashMap[String, Compiler]

def iterator = container.iterator

def get(id: String) = container.get(id)

override def size = container.size

def make(id: String, classpath: Array[URL], settings: Settings): Compiler = {
val runtime = Runtime.getRuntime
if (debug) println("Making compiler " + id)
if (debug) println(" memory before: " + (runtime.freeMemory/1048576.).formatted("%10.2f") + " MB")
if (debug) println(" memory before: " + freeMemoryString)
val comp = new Compiler(classpath, settings)
container += Pair(id, comp)
if (debug) println(" memory after: " + (runtime.freeMemory/1048576.).formatted("%10.2f") + " MB")
if (debug) println(" memory after: " + freeMemoryString)
comp
}

def break(id: String): Null = {
val runtime = Runtime.getRuntime
if (debug) println("Breaking compiler " + id)
if (debug) println(" memory before: " + (runtime.freeMemory/1048576.).formatted("%10.2f") + " MB")
if (debug) println(" memory before: " + freeMemoryString)
container -= id
System.gc
if (debug) println(" memory after: " + (runtime.freeMemory/1048576.).formatted("%10.2f") + " MB")
System.gc()
if (debug) println(" memory after: " + freeMemoryString)
null
}

private def freeMemoryString: String =
(Runtime.getRuntime.freeMemory/1048576.0).formatted("%10.2f") + " MB"
}

0 comments on commit e41184f

Please sign in to comment.