ruby on rails - Can .each have different GC impacts compared to .map? -
does 1 of these 2 garbage collect differently, or @ same?
array_of_strings.each |str| mailerclass.some_template(str).deliver_later end
vs.
array_of_strings.map |str| mailerclass.some_template(str).deliver_later end
i've formatted question mailer objects , task-queue stuff because it's have been working on recently, if unduly complicate answers can reword more generic.
context, relevant:
i considered
.map
return object pointed each object created, ,.each
not. [this seems not case]i have worker machine leaks memory until crashing — happening in 1 event in pseudo-code example central action. when changed
.each
.map
memory leak stopped, don't know how gc happening in regards these methods.
since map returns array of results of evaluating block each member of array_of_strings, there going @ least 1 object collected.
Comments
Post a Comment