分类: LINUX
2011-02-21 15:54:18
Lazy space allocation(什么是惰性空间分配)
Lazy allocation simply means not allocating a resource until it is actually needed. This is common with singleton objects, but strictly speaking, any time a resource is allocated as late as possible, you have an example of lazy allocation.
至到真正需要的时候再分配空间
By delaying allocation of a resource until you actually need it, you can decrease startup time, and even eliminate the allocation entirely if you never actually use the object. In contrast, you could pre-allocate a resource you expect to need later, which can make later execution more efficient at the expense of startup time, and also avoids the possibility of the allocation failing later in program execution.
减少响应时间,如果从来没有用到这个对象的情况下可以减少分配。