Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Grabage Collector in ruby, Why should I care ?
Search
Aboobacker MK
August 12, 2017
Programming
0
53
Grabage Collector in ruby, Why should I care ?
Ruby GC talk for Deccan ruby conf
Aboobacker MK
August 12, 2017
Tweet
Share
More Decks by Aboobacker MK
See All by Aboobacker MK
Conversational bots in ruby
tachyons
0
48
Other Decks in Programming
See All in Programming
Compiling Python to WebAssembly with py2wasm
syrusakbary
0
130
もうすぐ新年度、Babylon.jsがお勧めな3個の理由
hideg
0
160
CSRF対策のやり方、そろそろアップデートしませんか / Update your knowledge of CSRF protection
hiro_y
25
13k
WasmOS: Wasmを実行する自作Microkernel
riru
0
370
ドメイン・ファーストで考える問題解決に役立つモデル設計 / Domain First Model Design
suzushin54
1
940
OpenAPI を守るのは難しい
ohmori_yusuke
1
140
どうしてこうなった命名集 ~🔥編~ / OOC 2024 LT
pictiny
4
2.7k
「コンパイル時のユニットテスト」導入するとユニットテストを 書かなくてよくなるのか?
tomohisa
9
2.1k
デザインシステムで Tailwind CSSとCSS in JSに分散投資をしたら良かった話
fsubal
14
2.9k
フロントエンドパフォーマンス 入門
shouta2
7
1.5k
Honoとhtmx
yusukebe
6
1.2k
DDD, necessary but insufficient: physical design principles for microservices
cer
PRO
0
2.1k
Featured
See All Featured
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
319
20k
Testing 201, or: Great Expectations
jmmastey
27
6.3k
Put a Button on it: Removing Barriers to Going Fast.
kastner
58
3k
A Modern Web Designer's Workflow
chriscoyier
689
190k
Gamification - CAS2011
davidbonilla
76
4.5k
Why Our Code Smells
bkeepers
PRO
330
56k
Atom: Resistance is Futile
akmur
258
25k
Building Effective Engineering Teams - LeadDev
addyosmani
25
1.8k
Designing with Data
zakiwarfel
94
4.8k
Building Your Own Lightsaber
phodgson
97
5.6k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
153
14k
A Tale of Four Properties
chriscoyier
150
22k
Transcript
कचरा गोळा करणारा मी काळजी का क े ली पा
हजे 1
2
3 . 1
3 . 2
3 . 3
4
5
6
7
8
9
10
a = [ {c: 'd'} ] ... a = nil
11
12
13
14
a = [ {c: 'd'} ] 15
16
17
18
module GC def self.run mark sweep end def self.mark root_objects.each
do |root_obj| root_obj.associated_objects.each do |object| obj.update(marked: true) end end end def self.sweep objects.where(marked: false).destroy_all objects.update_all(marked: false) end end 19
20
21
22
23 . 1
23 . 2
24
25
26
module GC def self.run objects.update_all(color: white) clearly_living_objects.update_all(color: grey) objects.where(color: grey).each
do |object| object.references.update_all(color: grey) object.update(color: black) end objects.where(color: white).destroy_all end end 27
28
29
30
31
32
33 . 1
33 . 2
100_000.times do foo = "a string" end RETAINED = []
100_000.times do RETAINED << "a string" end 34
Model.all.each do |item| process(item) end Model.find_each do |item| process(item) end
Model.select(:id,:other, :necessary, :attributes) 35 . 1
class Thing; end list = Array.new(1000) { Thing.new } list.each
do |item| puts item end list = nil class Thing; end list = Array.new(1000) { Thing.new } while list.count > 0 puts list.pop end 35 . 2
36
37
38