Skip to content
This repository has been 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

Closed
xcporter opened this issue Jun 23, 2020 · 1 comment
Closed

Comments

@xcporter
Copy link

xcporter commented Jun 23, 2020

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()
    }
}
@mswokk
Copy link

mswokk commented Mar 16, 2021

Not sure about cause of this issue is same with my issue,
I tried to fix some memory leaking.
See #1318 , #1319

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants