I am trying to run a rgl shiny app, it works well on my computer but crashes on www.shinyapps.io.
I suspect that the 1GB memory is not enough as the shinyapps.io log tells me Container event from container-8564782: oom (out of memory)
.
It is 6 triangle3d() relatively complex objects in one rglwidget(). A button create a new translation of these 6 objects and plot it in a new rgl object. I tried to put lit=FALSE
in the object to save memory, but it still crashes (not always though).
I also suspect that the rgl object is not erased from memory when creating a new one. So I tried rglwidget options (reuse=NA, webGLoptions = list(preserveDrawingBuffer = FALSE)
), but deploying for testing is not very efficient...
- Is there a way to test the app locally with the same 1GB memory?
- Are there other obvious ways to save memory when using rgl/shiny?
Any pointer welcome!
https://colomb.shinyapps.io/RANDOMstage/ core of the code:
observe({
input$randomise
#### Create a random position of each objects using translate3d, plot them using triangle3d.
amessage = random_obj( objects= objects, position_tot =position_tot, messagesday=messagesday, colorpalette=palette("Okabe-Ito"))
output$rglPlot <- renderRglwidget({
createboden()
view3d (theta = 0, phi = -88, zoom = 0.8, fov = 60)
outputwidget = rglwidget(reuse=NA, webGLoptions = list(preserveDrawingBuffer = FALSE))
outputwidget
})