1

Im using Meck to simulate the behavior of some external services i have, purely for the sake of load testing and profiling my system, But it is causing me some issues. basically I have lots of worker processes being spawned, which then timeout after 10 seconds if nothing calls them, but when I have meck overriding the call to my external processes they seem to timeout and exit as expected, but they are never garbage collected, causing my applications memory usage to just keep going up and up as more workers are spawned

Stowelly
  • 1,260
  • 2
  • 12
  • 31
  • Could you paste some small code that reproduces the behavior you're getting? – Javier Oct 17 '13 at 20:47
  • Just spent the last hour making a new otp project that will mirror the functionality, and discovered that the process is correctly terminating, BUT as meck has touched the binary it isnt being garbage collected, causing my memory usage to just keep increasing, which obviously isnt ideal for this! – Stowelly Oct 18 '13 at 09:12
  • What binaries are we talking about? Something Meck created or something your program created? – Adam Lindberg Oct 21 '13 at 20:02
  • the process binaries, my program creates the processes, meck touches them incrementing the refc, which is then not cleaned up until i kill meck, im realising this is actually a language thing rather than meck, so i dont expect a solution, ill just use a macro and specify at compile time what i want to do. thanks anyway. http://dieswaytoofast.blogspot.co.uk/2012/12/erlang-binaries-and-garbage-collection.html – Stowelly Oct 22 '13 at 07:04

1 Answers1

0

Seems this is due to how Erlang handles binaries and references: http://dieswaytoofast.blogspot.co.uk/2012/12/erlang-binaries-and-garbage-collection.html

my solution is to just have a macro defining the function which should be used, and switching that for a fake function at compile time, seems to work for now

Stowelly
  • 1,260
  • 2
  • 12
  • 31