Latest

把衣服的鬆緊帶穿回去的方法

當衣服的鬆緊帶如果有一邊跑進去,要如何解決? 有一辦法可以先把鬆緊帶全部抽出來,再用直徑比較細的原子筆管讓鬆緊帶穿進去,之後在順著褲子的鬆緊帶洞口用手把它穿過去。這方法我用在我的褲子上,最後是成功的。 (最近才把以前的照片紀錄上傳,具體步驟只能依印象而寫) 鬆緊帶 準備工具除了鬆緊帶,還有:剪刀、美工刀、膠帶、原子筆管 鬆緊帶穿過筆管後,可以用膠帶把筆管前端和鬆緊帶黏住,以防鬆緊帶穿到一半跑出筆管 有些地方穿不過去時可以用剪刀或美工刀稍微開個小洞 完成後就卸下膠帶和筆管!

對於「The Stack Is An Implementation Detail」系列文章之筆記

The Stack Is An Implementation Detail系列文由Eric Lippert所寫
Eric Lippert曾經在微軟工作,部落格為Fabulous adventures in coding

- - - 第一篇的筆記 - - -


第一篇之前看完了但沒做筆記
也許等重看時再補上


- - - 第二篇的筆記 - - -



allocation 分配
deallocation 釋放

heap有holes

formal parameter或parameter像是下面舉例的Test函式中的的x:
void Test(int x)
{
    ...
}

呼叫函式時的x則稱作argument:
Test(x)


文章中寫了garbage collection (GC)的運作:
"When a garbage collection is performed there are three phases: mark, sweep and compact. In the “mark” phase, we assume that everything in the heap is “dead”. The CLR knows what objects were “guaranteed alive” when the collection started, so those guys are marked as alive. Everything they refer to is marked as alive, and so on, until the transitive closure of live objects are all marked. In the “sweep” phase, all the dead objects are turned into holes. In the “compact” phase, the block is reorganized so that it is one contiguous block of live memory, free of holes."

簡單來說就是GC有三個階段:mark、sweep、compact




CLR collector是世代相傳的
放在heap裡的object的生命週期有:長、中、短之分
從短週期的開始,如果存活下來就移動到中週期的,再來則到長週期的
GC時常在短週期的heap裡執行;長週期的則相反
他們這麼做的想法是不想花費時間檢查長週期的,此外得迅速回收短週期的

留言

這個網誌中的熱門文章

Win 10 變更注音輸入法選字窗的大小

國泰世華信用卡 異常簽帳消費