Skip to content
This repository was archived by the owner on Sep 28, 2024. It is now read-only.
This repository was archived by the owner on Sep 28, 2024. It is now read-only.

Instance (or some part of it) not released from heap after closing in JPro #1251

@xcporter

Description

@xcporter

Hello!

I'm currently working with TornadoFX 1.7.20, and serving a demo on the web with JPro. I'm running a heap size of 350mB, and after about 5 to 10 instances launched and closed, I start having low memory issues. Looking at a profile, it seems the amount left over is about 40mB per login. I don't see any memory issues unless I'm running multiple instances on the same jvm.

I am using a menu structure built with the EventBus, and there are also a few custom Fragments and UI components as well. Additionally, I suspect that the way I build certain node trees with functions might be to blame.

Is there something more I should be doing to release Views, Components, etc. from memory?
I'm somewhat new to the JVM environment, but it looks like NIO HeapByteBuffers are taking up the most space.

Here are the JVM arguments:

-Xms350m
-Xmx350m
-XX:+UseG1GC
-XX:MaxGCPauseMillis=200

Simplified version of project: https://github.com/xcporter/memtest

Possible leak suspects:

EventBus use, also--
does this EventHandler need to be manually unsubscribed?

menuButton.addEventHandler(MOUSE_PRESSED) { fire(ViewChange(ViewState.MENU, scope)) }

class ViewChange(val state: ViewState, scope: Scope) : FXEvent(scope = scope)

subscribe<ViewChange> {}

the way views are replaced

root.center.replaceWith(
                            find<ColumnConnect>().root,
                            transition = ViewTransition.Slide(0.5.seconds, ViewTransition.Direction.LEFT)
                    )

jpro scope/ setup

class WebScope(val stage: Stage) : Scope() {
    val webAPI: WebAPI get() = WebAPI.getWebAPI(stage)
}

class Main : JProApplication() {
    val app = EfasApp()

    override fun start(primaryStage: Stage) {
        app.scope = WebScope(primaryStage)
        app.start(primaryStage)
    }

    override fun stop() {
        app.stop()
        super.stop()
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions