OSDN Git Service

Fix internal issue #1898791 ("PlatformAddressFactory PlatformAddress cache
authorDan Bornstein <danfuzz@android.com>
Wed, 10 Jun 2009 20:05:51 +0000 (13:05 -0700)
committerDan Bornstein <danfuzz@android.com>
Wed, 10 Jun 2009 20:05:51 +0000 (13:05 -0700)
commit32c0ded21ec8cd40f27015b4e65ec6a1bd78ef9a
treec88a5b3a87b0b81b9b8bb037330d4aed75c00675
parent3a73bd95c7ea75a8e3814f76f4059c9ee7822fe0
Fix internal issue #1898791 ("PlatformAddressFactory PlatformAddress cache
causes memory to not be freed in a timely manner.").

The change makes the two PlatformAddressFactory.alloc() methods always
allocate separate PlatformAddress objects instead of looking for them
in the cache. This means that, should they have auto-free turned on,
there won't be a reference in the cache that prevents the freeing from
happening. And since we're talking about freshly-allocated memory anyway,
it would be surprising that either a matching address would be found in
cache *or* that a subsequent call to on() would ever happen with the
same address. So, it's a win on several fronts.
libcore/luni/src/main/java/org/apache/harmony/luni/platform/PlatformAddressFactory.java