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
66
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
61
Other Decks in Programming
See All in Programming
意外と簡単!?フロントエンドでパスキー認証を実現する WebAuthn
teamlab
PRO
2
740
RDoc meets YARD
okuramasafumi
4
170
基礎から学ぶ大画面対応(Learning Large-Screen Support from the Ground Up)
tomoya0x00
0
420
Swift Updates - Learn Languages 2025
koher
2
470
Rancher と Terraform
fufuhu
2
240
FindyにおけるTakumi活用と脆弱性管理のこれから
rvirus0817
0
500
時間軸から考えるTerraformを使う理由と留意点
fufuhu
15
4.7k
私の後悔をAWS DMSで解決した話
hiramax
4
210
デザイナーが Androidエンジニアに 挑戦してみた
874wokiite
0
320
速いWebフレームワークを作る
yusukebe
5
1.7k
プロポーザル駆動学習 / Proposal-Driven Learning
mackey0225
2
1.3k
パッケージ設計の黒魔術/Kyoto.go#63
lufia
3
430
Featured
See All Featured
It's Worth the Effort
3n
187
28k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
33
2.4k
Music & Morning Musume
bryan
46
6.8k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
252
21k
Building Adaptive Systems
keathley
43
2.7k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Agile that works and the tools we love
rasmusluckow
330
21k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
15
1.6k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Speed Design
sergeychernyshev
32
1.1k
Building Better People: How to give real-time feedback that sticks.
wjessup
368
19k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
188
55k
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