I have a ‘worker’ process which I am going to assign to a job. Before I spawn hundreds of processes of this type I would like to know the memory consumption figures for it.
I know that I should sum all the elements which are stored in the process’ loop data (all tuples, atoms, lists, etc) and the actual process memory footprint.
As I understand, before doing that I have to know the actual size of a {tuple|atom|list|process} itself.
Given a certain data structure which is stored in the process’ memory how can I calculate the overall size of the process in memory?
erlang:process_info/2will give you the amount of memory, in bytes, that a process occupies. For example:Note that binaries are not included since they are not located in the process heap. Those you have to count the size of manually.