To reprodue the bug:
git clone git@github.com:sickill/ecto-preload-bug.git
cd ecto-preload-bug
mix do deps.get, ecto.create, ecto.migrate
iex -S mix
In iex run following commands:
:observer.start
, switch to "Load Charts" tabPreloadBug.once
- this preloads once, no memory spike should be observedPreloadBug.twice
- this runs the same preload on alrady preload schema - observe huge memory spike, ~1 GB in this example project. In the project I discovered it we see 3-5 GB spike.PreloadBug.twice_not_in_parallel
- same as above but explicitly disable parallel loading - no memory spike!