Shiny Memory leak R
I'm trying to solve a memory leak in Shiny, R. I'm using the pryr package to print memory. Here is some simple code, if I leave this running, the memory will just continually increase. It makes me think either I don't understand memory use, or there is something wrong with shiny/pryr?
library(shiny)
library(pryr)
ui<-fluidPage(
textOutput("Memory"))
server <- function(input, output, session) {
memUsed <- function() {paste0(round(mem_used()/1000000,3)," mb")}
output$"Memory"<-renderText({
invalidateLater(10)
memUsed()
})
}
shinyApp(ui, server)
When I first started trying to solve the memory leaks I was encountering, I thought my only issue was the use of things like observe/observe event, and had asked first a question on how to locate a memory leak: R Shiny Memory Leak - Suggestions on how to find? Then I had a more specific example of code with a memory leak: Solving a memory leak - Shiny R Though I've made some personal progress on that front to reduce the memory, I'm still leaking. The amount is certainly small, but after a week this number will increase into the gigabyte range, reducing the speed of my program.
I've tried using the function as is, making it reactive, or just not using the memUsed function and just placing the paste0 into the output to no avail. I've tried this code on both a PC and a Mac and it does the same. I've been trying to identify other related things like: https://github.com/rstudio/shiny/issues/1253 and https://github.com/rstudio/shiny/issues/1591 But I have yet to see anything that at least makes me understand the issue.
r memory-leaks shiny
add a comment |
I'm trying to solve a memory leak in Shiny, R. I'm using the pryr package to print memory. Here is some simple code, if I leave this running, the memory will just continually increase. It makes me think either I don't understand memory use, or there is something wrong with shiny/pryr?
library(shiny)
library(pryr)
ui<-fluidPage(
textOutput("Memory"))
server <- function(input, output, session) {
memUsed <- function() {paste0(round(mem_used()/1000000,3)," mb")}
output$"Memory"<-renderText({
invalidateLater(10)
memUsed()
})
}
shinyApp(ui, server)
When I first started trying to solve the memory leaks I was encountering, I thought my only issue was the use of things like observe/observe event, and had asked first a question on how to locate a memory leak: R Shiny Memory Leak - Suggestions on how to find? Then I had a more specific example of code with a memory leak: Solving a memory leak - Shiny R Though I've made some personal progress on that front to reduce the memory, I'm still leaking. The amount is certainly small, but after a week this number will increase into the gigabyte range, reducing the speed of my program.
I've tried using the function as is, making it reactive, or just not using the memUsed function and just placing the paste0 into the output to no avail. I've tried this code on both a PC and a Mac and it does the same. I've been trying to identify other related things like: https://github.com/rstudio/shiny/issues/1253 and https://github.com/rstudio/shiny/issues/1591 But I have yet to see anything that at least makes me understand the issue.
r memory-leaks shiny
1
I'd recommend that you fill out your own github issue for this problem (github.com/rstudio/shiny/issues/new). It's likely you'll need the help of the shiny developers rather than other shiny users that you'd find on Stack Overflow.
– MrFlick
Nov 20 '18 at 22:12
Thanks, I'll give that a go: github.com/rstudio/shiny/issues/2267
– Silentdevildoll
Nov 20 '18 at 22:35
add a comment |
I'm trying to solve a memory leak in Shiny, R. I'm using the pryr package to print memory. Here is some simple code, if I leave this running, the memory will just continually increase. It makes me think either I don't understand memory use, or there is something wrong with shiny/pryr?
library(shiny)
library(pryr)
ui<-fluidPage(
textOutput("Memory"))
server <- function(input, output, session) {
memUsed <- function() {paste0(round(mem_used()/1000000,3)," mb")}
output$"Memory"<-renderText({
invalidateLater(10)
memUsed()
})
}
shinyApp(ui, server)
When I first started trying to solve the memory leaks I was encountering, I thought my only issue was the use of things like observe/observe event, and had asked first a question on how to locate a memory leak: R Shiny Memory Leak - Suggestions on how to find? Then I had a more specific example of code with a memory leak: Solving a memory leak - Shiny R Though I've made some personal progress on that front to reduce the memory, I'm still leaking. The amount is certainly small, but after a week this number will increase into the gigabyte range, reducing the speed of my program.
I've tried using the function as is, making it reactive, or just not using the memUsed function and just placing the paste0 into the output to no avail. I've tried this code on both a PC and a Mac and it does the same. I've been trying to identify other related things like: https://github.com/rstudio/shiny/issues/1253 and https://github.com/rstudio/shiny/issues/1591 But I have yet to see anything that at least makes me understand the issue.
r memory-leaks shiny
I'm trying to solve a memory leak in Shiny, R. I'm using the pryr package to print memory. Here is some simple code, if I leave this running, the memory will just continually increase. It makes me think either I don't understand memory use, or there is something wrong with shiny/pryr?
library(shiny)
library(pryr)
ui<-fluidPage(
textOutput("Memory"))
server <- function(input, output, session) {
memUsed <- function() {paste0(round(mem_used()/1000000,3)," mb")}
output$"Memory"<-renderText({
invalidateLater(10)
memUsed()
})
}
shinyApp(ui, server)
When I first started trying to solve the memory leaks I was encountering, I thought my only issue was the use of things like observe/observe event, and had asked first a question on how to locate a memory leak: R Shiny Memory Leak - Suggestions on how to find? Then I had a more specific example of code with a memory leak: Solving a memory leak - Shiny R Though I've made some personal progress on that front to reduce the memory, I'm still leaking. The amount is certainly small, but after a week this number will increase into the gigabyte range, reducing the speed of my program.
I've tried using the function as is, making it reactive, or just not using the memUsed function and just placing the paste0 into the output to no avail. I've tried this code on both a PC and a Mac and it does the same. I've been trying to identify other related things like: https://github.com/rstudio/shiny/issues/1253 and https://github.com/rstudio/shiny/issues/1591 But I have yet to see anything that at least makes me understand the issue.
r memory-leaks shiny
r memory-leaks shiny
asked Nov 20 '18 at 22:03
SilentdevildollSilentdevildoll
634
634
1
I'd recommend that you fill out your own github issue for this problem (github.com/rstudio/shiny/issues/new). It's likely you'll need the help of the shiny developers rather than other shiny users that you'd find on Stack Overflow.
– MrFlick
Nov 20 '18 at 22:12
Thanks, I'll give that a go: github.com/rstudio/shiny/issues/2267
– Silentdevildoll
Nov 20 '18 at 22:35
add a comment |
1
I'd recommend that you fill out your own github issue for this problem (github.com/rstudio/shiny/issues/new). It's likely you'll need the help of the shiny developers rather than other shiny users that you'd find on Stack Overflow.
– MrFlick
Nov 20 '18 at 22:12
Thanks, I'll give that a go: github.com/rstudio/shiny/issues/2267
– Silentdevildoll
Nov 20 '18 at 22:35
1
1
I'd recommend that you fill out your own github issue for this problem (github.com/rstudio/shiny/issues/new). It's likely you'll need the help of the shiny developers rather than other shiny users that you'd find on Stack Overflow.
– MrFlick
Nov 20 '18 at 22:12
I'd recommend that you fill out your own github issue for this problem (github.com/rstudio/shiny/issues/new). It's likely you'll need the help of the shiny developers rather than other shiny users that you'd find on Stack Overflow.
– MrFlick
Nov 20 '18 at 22:12
Thanks, I'll give that a go: github.com/rstudio/shiny/issues/2267
– Silentdevildoll
Nov 20 '18 at 22:35
Thanks, I'll give that a go: github.com/rstudio/shiny/issues/2267
– Silentdevildoll
Nov 20 '18 at 22:35
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53402267%2fshiny-memory-leak-r%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53402267%2fshiny-memory-leak-r%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
I'd recommend that you fill out your own github issue for this problem (github.com/rstudio/shiny/issues/new). It's likely you'll need the help of the shiny developers rather than other shiny users that you'd find on Stack Overflow.
– MrFlick
Nov 20 '18 at 22:12
Thanks, I'll give that a go: github.com/rstudio/shiny/issues/2267
– Silentdevildoll
Nov 20 '18 at 22:35