This repository was archived by the owner on Aug 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 57
This repository was archived by the owner on Aug 10, 2024. It is now read-only.
MemoryLeak #595
Copy link
Copy link
Open
Description
The library probably contains a memory leak. If KVar is updated regularly, the server consumes more and more memory until the OutOfMemoryError occurs.
I have created a sample project to reproduce this behavior.
https://github.com/betschwa/KWebMemoryProblemTest
Here is the job for updating a KVar:
val webServerMemoryLoad = KVar(initialValue = MemoryLoad())
webServerMemoryLoadJob = scope.launch {
val runtime = Runtime.getRuntime()
while (isActive) {
val load = MemoryLoad(max = runtime.maxMemory(),
free = runtime.freeMemory(),
total = runtime.totalMemory())
webServerMemoryLoad.value = load
delay(duration = 1.seconds)
}
}
Here is the display:
div(attributes = fomantic.field) {
label().addText(value = "Used [MB]")
div(attributes = fomantic.ui.input) {
render(webServerMemoryLoad) { memoryLoad ->
input(type = InputType.text) { element ->
element.setReadOnly(true)
}.value.value = memoryLoad.usedText
}
}
}
div(attributes = fomantic.field) {
label().addText(value = "Free [MB]")
div(attributes = fomantic.ui.input) {
render(webServerMemoryLoad) { memoryLoad ->
input(type = InputType.text) { element ->
element.setReadOnly(true)
}.value.value = memoryLoad.freeText
}
}
}
div(attributes = fomantic.field) {
label().addText(value = "Total [MB]")
div(attributes = fomantic.ui.input) {
render(webServerMemoryLoad) { memoryLoad ->
input(type = InputType.text) { element ->
element.setReadOnly(true)
}.value.value = memoryLoad.totalText
}
}
}
div(attributes = fomantic.field) {
label().addText(value = "Max. [MB]")
div(attributes = fomantic.ui.input) {
render(webServerMemoryLoad) { memoryLoad ->
input(type = InputType.text) { element ->
element.setReadOnly(true)
}.value.value = memoryLoad.maxText
}
}
}
Metadata
Metadata
Assignees
Labels
No labels