buildkit/client/llb
Erik Sipsma 3b418db323 llb: Cache DefinitionOp inputs to support memoization during Marshal
llb.State.Marshal uses a vertexCache map (keyed by the llb.Vertex interface
value) to memoize which vertexes it has already visited while marshalling.

However, before this change, llb.DefinitionOp was constructing new pointers for
each value in the return slice of Inputs(), which meant that each input had a
different key in the vertexCache (due to being different pointer values). This
meant no memoization actually occured. I noticed this while using
llb.DefinitionOp with a fairly large graph when my program crashed after using
>16GB of RSS during a call to llb.State.Marshal.

The fix here avoids changing vertexCache as that would impact many other
vertex implementations. Instead, just DefinitionOp.Inputs() is updated to cache
the pointers it creates and pass that cache to its descendents. This fix
resulted in the program that was previously crashing out-of-memory to run
without any perceivable increase in RSS.

Signed-off-by: Erik Sipsma <erik@sipsma.dev>
2020-08-10 17:23:04 -07:00
..
imagemetaresolver Allow previous solve results to be used in new solves 2020-01-23 11:02:40 -08:00
llbbuild lint: add misspell and unused 2020-07-18 08:13:57 -07:00
llbtest Provide the known default PATH to the llbtest test 2020-07-28 18:07:20 +10:00
async.go Allow multiple source locations to be added as a constraint 2020-05-20 16:48:44 -07:00
async_test.go llb: asyncronous llb graph generation support 2020-04-03 14:55:10 -07:00
definition.go llb: Cache DefinitionOp inputs to support memoization during Marshal 2020-08-10 17:23:04 -07:00
definition_test.go llb: Cache DefinitionOp inputs to support memoization during Marshal 2020-08-10 17:23:04 -07:00
exec.go lint: enable golint 2020-07-19 09:28:24 -07:00
exec_test.go add unit test for getmount output index 2020-06-04 18:25:03 -07:00
fileop.go lint: enable golint 2020-07-19 09:28:24 -07:00
fileop_test.go llb: asyncronous llb graph generation support 2020-04-03 14:55:10 -07:00
marshal.go Allow multiple source locations to be added as a constraint 2020-05-20 16:48:44 -07:00
meta.go lint: enable more linters 2020-07-19 09:28:36 -07:00
meta_test.go llb: asyncronous llb graph generation support 2020-04-03 14:55:10 -07:00
resolver.go llb: update image meta resolver to async callback 2020-04-05 22:25:02 -07:00
resolver_test.go llb: update image meta resolver to async callback 2020-04-05 22:25:02 -07:00
source.go lint: enable golint 2020-07-19 09:28:24 -07:00
sourcemap.go Fix duplicate source maps and fix issue preventing multiple locations per source map 2020-05-20 18:48:20 -07:00
state.go Allow multiple source locations to be added as a constraint 2020-05-20 16:48:44 -07:00
state_test.go Fix duplicate source maps and fix issue preventing multiple locations per source map 2020-05-20 18:48:20 -07:00