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
iOSエンジニア向けの英語学習アプリを作る!
yukawashouhei
0
190
大規模アプリのDIフレームワーク刷新戦略 ~過去最大規模の並行開発を止めずにアプリ全体に導入するまで~
mot_techtalk
1
430
オープンソースソフトウェアへの解像度🔬
utam0k
13
2.6k
Server Side Kotlin Meetup vol.16: 内部動作を理解して ハイパフォーマンスなサーバサイド Kotlin アプリケーションを書こう
ternbusty
3
180
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
310
Cloudflare AgentsとAI SDKでAIエージェントを作ってみた
briete
0
140
Your Perfect Project Setup for Angular @BASTA! 2025 in Mainz
manfredsteyer
PRO
0
170
NixOS + Kubernetesで構築する自宅サーバーのすべて
ichi_h3
0
640
CSC305 Lecture 04
javiergs
PRO
0
270
Serena MCPのすすめ
wadakatu
4
980
SpecKitでどこまでできる? コストはどれくらい?
leveragestech
0
700
Railsだからできる 例外業務に禍根を残さない 設定設計パターン
ei_ei_eiichi
0
470
Featured
See All Featured
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
252
21k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Code Review Best Practice
trishagee
72
19k
How GitHub (no longer) Works
holman
315
140k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.4k
Mobile First: as difficult as doing things right
swwweet
224
10k
Optimizing for Happiness
mojombo
379
70k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.5k
Thoughts on Productivity
jonyablonski
70
4.9k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
140
34k
Typedesign – Prime Four
hannesfritz
42
2.8k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
620
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