From: Miguel H. <mt...@mt...> - 2004-01-15 14:10:35
|
>> You are correct. It is completely redundant and only creates >> additional allocations ... and more work for the garbage collector. > > Will an appropriate correction improve CDK performance regarding memory > usage ? It will *not* reduce the amount of memory ... memory footprint ... required by CDK. It *will* improve runtime performance. These objects were allocated in the class constructor and assigned to the member variables. The method init() was then called. It allocated new objects and assigned them to the same member variables. The references to the initial objects were lost. When these references went away the memory could be reclaimed by the garbage collector. In this way, the space gets reused. So, we didn't save any space, but we did save some time. Actually, we did save a *little* space ... the object code got a little smaller (50 bytes? 100 bytes?) because it was no longer making the calls to allocate the objects and store the results :-) Miguel |