From fab5e4372a941ee4259adea9295f49dcadca26a4 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Tue, 10 Dec 2019 14:06:35 -0700 Subject: core: Add godoc examples for LoadModule --- context.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'context.go') diff --git a/context.go b/context.go index c95b08f..e515cb9 100644 --- a/context.go +++ b/context.go @@ -124,7 +124,9 @@ func (ctx *Context) OnCancel(f func()) { // and store them on the same struct. Storing them on the same struct makes for // easy garbage collection when your host module is no longer needed. // -// Loaded modules have already been provisioned and validated. +// Loaded modules have already been provisioned and validated. Upon returning +// successfully, this method clears the json.RawMessage(s) in the field since +// the raw JSON is no longer needed, and this allows the GC to free up memory. func (ctx Context) LoadModule(structPointer interface{}, fieldName string) (interface{}, error) { val := reflect.ValueOf(structPointer).Elem().FieldByName(fieldName) typ := val.Type() -- cgit v1.2.3