Github user felixcheung commented on a diff in the pull request: https://github.com/apache/spark/pull/14775#discussion_r75953989 --- Diff: R/pkg/R/jobj.R --- @@ -82,7 +82,20 @@ getClassName.jobj <- function(x) { callJMethod(cls, "getName") } -cleanup.jobj <- function(jobj) { +#' Garbage collect Java Objects +#' +#' Garbage collect an object allocated on Spark driver JVM heap. +#' +#' cleanup.jobj is a low level method that lets developers manually garbage collect objects +#' allocated using newJObject. This is only to be used for advanced use cases as objects allocated +#' on the JVM heap are automatically garbage collected when the corresponding R reference goes out +#' of scope. +#' +#' @param x the Java object that should be garbage collected. +#' @note cleanup.jobj since 2.0.1 +#' @export +cleanup.jobj <- function(x) { + jobj <- x if (isValidJobj(jobj)) { --- End diff -- isValidJobj doesn't currently check, I think we should add a `if (class(jobj) == 'jobj')` before that
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org