unity 3D 内存管理

1. 避免使用str+=“dddd” 。 string每次赋值,就是重新的分配内存。 如果要多次+字符串,采用stringbuilder。

2.使用索引 a[i] 而不是 a0 = a[0] .

3. 多使用struct 等数据结构,因为他是分配连续的内存,便于管理。

http://en.wikipedia.org/wiki/Object_pool_pattern

http://www.memorymanagement.org/

http://sourcemaking.com/design_patterns/object_pool

posted @ 2014-08-14 09:33  penney  阅读(126)  评论(0)    收藏  举报