# 2019q1 第 7 週測驗題 (下) --- ### 測驗 `1` 考慮到一個以 reference counting 為基礎的精簡 [garbage collector](https://en.wikipedia.org/wiki/Garbage_collection_(computer_science)) 的實作 [OGC](https://github.com/jserv/ogc),請觀看線上課程 [17.2| Mark and Sweep](https://www.youtube.com/watch?v=2XKifr16o7Y),簡述 OGC 裡頭 reference counting 的運作機制,以及如何實作出 mark and sweep。 --- ### 測驗 `2` 承測驗 `1`,改寫 [tests/string-separate.c](https://github.com/jserv/ogc/blob/master/tests/string-separate.c),提供支援 GC 的 `strdup` 實作,允許在 `gc_run()` 呼叫後,釋放沒有參照到的記憶體。 :::success 提交 `string-duplicate.c` 的程式內容,儘量保持程式碼的簡潔 ::: 參考資訊: * [C 標準中不包括 strdup 的理由是什麼?](http://www.voidcn.com/article/p-kqqlsnfn-buy.html) ---
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up