ประโยคภาษาจีน : 中文句子 |
---|
yào 要 shí xiàn 实现 yǐn yòng 引用 jì shù 计数 nín 您 zhǐ 只 xū yào 需要 liǎng gè 两个 hán shù 函数 yí gè 一个 zēng jiā 增加 yǐn yòng 引用 jì shù 计数 yí gè 一个 jiǎn shǎo 减少 yǐn yòng 引用 jì shù 计数 bìng 并 dāng 当 jì shù 计数 jiǎn shǎo 减少 dào 到 líng shí 零时 shì fàng 释放 nèi cún 内存 |
To implement reference counting, you simply need two functions -- one to increase the reference count, and one to decrease the reference count and free the memory when the count drops to zero. |