Skip to content

Commit

Permalink
Fix memory usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Karasiq committed Jul 25, 2020
1 parent fcaf9cc commit ebeb314
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ val packageSettings = Seq(
Some(file(s"setup/icon.$iconExt"))
},
jdkPackagerType := "installer",
jdkPackagerJVMArgs := Seq("-Xmx2G", "-XX:+UseG1GC"),
jdkPackagerJVMArgs := Seq("-Xmx1G", "-XX:+UseG1GC"),
jdkPackagerProperties := Map(
"app.name" "shadowcloud",
"app.version" version.value.replace("-SNAPSHOT", ""),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.karasiq.shadowcloud.console

import akka.actor.ActorSystem

import com.karasiq.common.configs.ConfigImplicits._
import com.karasiq.shadowcloud.ShadowCloud
import com.karasiq.shadowcloud.drive.fuse.SCFuseHelper
import com.typesafe.config.impl.ConfigImpl

import scala.concurrent.Await
import scala.concurrent.duration._
import scala.util.Try
Expand All @@ -22,6 +22,11 @@ object SCConsoleMain extends App {
val sc = ShadowCloud(actorSystem)
import sc.implicits.executionContext

// LArray memory fix
actorSystem.scheduler.scheduleAtFixedRate(30 seconds, 15 seconds) { ()
System.gc()
}(actorSystem.dispatcher)

sys.addShutdownHook {
Try(sc.shutdown())
Try(Await.result(actorSystem.terminate(), 15 seconds))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import com.karasiq.shadowcloud.ShadowCloud
import com.karasiq.shadowcloud.drive.fuse.SCFuseHelper
import com.karasiq.shadowcloud.server.http.SCAkkaHttpServer
import com.typesafe.config.impl.ConfigImpl
import scala.concurrent.duration._

import scala.concurrent.Future
import scala.util.Try
Expand All @@ -22,6 +23,11 @@ object SCDesktopMain extends App {

implicit val actorSystem = ActorSystem("shadowcloud", config)

// LArray memory fix
actorSystem.scheduler.scheduleAtFixedRate(30 seconds, 15 seconds) { ()
System.gc()
}(actorSystem.dispatcher)

val sc = ShadowCloud(actorSystem)

sc.init()
Expand Down

0 comments on commit ebeb314

Please sign in to comment.