diff --git a/NEWS.md b/NEWS.md index 7d2bc58b..3fe55f6b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,8 @@ +# mlr3misc 0.12.0-9000 + +* fix: Fixed an important bug that caused serialized objects to be overly large +when installing mlr3 with `--with-keep.source` (#88) + # mlr3misc 0.12.0 * Added new encapsulation mode `"try"`. diff --git a/R/leanify.R b/R/leanify.R index ea8b217a..9cd6bcf4 100644 --- a/R/leanify.R +++ b/R/leanify.R @@ -43,6 +43,10 @@ leanificate_method = function(cls, fname, env = cls$parent_env) { environment(replacingfn) = environment(fn) function_kind = switch(function_kind_container, public_methods = "public", private_methods = "private", active = "active") + # We remove the srcref (which exists when installing with option --with-keep.source) because: + # (1) incorrect rendering of leanified functions + # (2) use up memory unnecessarily + origattributes$srcref = NULL attributes(replacingfn) = origattributes cls$set(function_kind, fname, replacingfn, overwrite = TRUE) }