From 83a974f0999975e6c56acd0b37a14a24ab8378dd Mon Sep 17 00:00:00 2001 From: Nate Berkopec Date: Sat, 8 Apr 2017 07:50:49 -0600 Subject: [PATCH] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 3d699a8..43cfb33 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,8 @@ Here is a list of questions I have. Feel free to make a PR to answer them. * Retained Vs Allocated: Does an object that is allocated can turn to be retained because he is still present after few GC ? + Yes. The term "allocated" vs "retained" may vary depending on the tool you use, but, for example, in `memory_profiler`, "retained" means "survived a major GC". + * **[Answered]** What are the first line of a heap dump that are not address ? Header of the heap dump [from heapy gem](https://github.com/schneems/heapy/tree/master/spec/fixtures/dumps) (carefull is 78mo text file) @@ -108,6 +110,8 @@ Here is a list of questions I have. Feel free to make a PR to answer them. * Why people are always scared about time spent in GC when the Newrelic graph of my app show an average time spent in GC that is 0.0676% ? +Personal opinion - most people *assume* garbage collection takes a lot of time in a GC'd language. GC languages are slower than non-GC'd languages, therefore it must be GC that is slow. However, it's not just *GC* but *allocation* and the record keeping that goes along with it that slows Ruby programs. Creating an object isn't just the simple process of writing to some memory location, we have to do a bunch of checks, look for free space in the ObjectSpace, etc etc. So a GC'd language *is* slower, but we actually incur most of the cost *while running the program*, not *when garbage collecting*. + * Why when using a frozen string we don't allocate memory ? I use a method because it represents "patterns" we discuss with my team, I try to measure the number of allocations betweens calling directly string, calling a string set into a constant outside the function and calling a string frozen in a constant outside the function.