godot-start/doc/demo02_base/base2.md

21 lines
565 B
Markdown
Raw Normal View History

2022-01-02 10:47:19 +00:00
# 1. 内存管理free
- godot中的对象分为两种
- 引用计数对象继承于Reference当没有引用时会被自动回收
- 非引用计数对象没有继承于Reference自能自己手动回收,free或queue_free
![Image text](image/gc.JPG)
# 2. 垃圾回收的缺点
![Image text](image/gc1.png)
![Image text](image/gc2.png)
![Image text](image/gc3.png)
# 3. 引用计数
- 可以使用unreference去释放引用计数的对象
2022-01-03 08:59:00 +00:00
- 引用计数既保留了性能,也保证了更加高效的性能
![Image text](image/太极.png)