From: Shigeru C. <ch...@is...> - 2003-02-18 05:42:07
|
From: Grzegorz Jakacki <ja...@he...> Subject: [Opencxx-users] Re: [opencxx] Porting to MacOs X Date: Tue, 18 Feb 2003 08:48:21 +0800 (CST) > > > > PS: If this does not work, however, there is possibly a way to get rid > > > > of GC at all with help of boost::shared_ptr<>. > > > > Memory management with smart pointers > > should be slower than with GC... > > Why? I do not disagree, but I am still looking for convincing argument. Yes, the performance depends on memory usage patterns. GC should work better if a large number of objects are allocated and soon deallocated before the next GC phase. Suppose that 100 objects are allocated and then 90 of them are deallocated. The deallocation cost with smart pointers is 90 * <time for free()>. On the other hand, if GC (except reference counting GC) is used, the deallocation cost is 10 * <time for collecting a live object>. I know this discussion is very rough, but my understanding is GC is rather fast under some circumstances. Chiba |