Open GoogleCodeExporter opened 9 years ago
Good suggestions! May I add to your upper list a
3) Make all methods that accept transactions call MemoryPool.intern(), so the
API user do not need to care about it.
(Of course, if immutability and a well defined definition of equalness is in
place it will not be needed any more.)
It's possible that if the memory pool is a single in future we probably will
need some purging mechanism. Otherwise memory constrained apps will run out of
memory at some time. Currently in the Android app, PeerGroup is not alive for
more than a few minutes which keeps the memory pool at a reasonable size.
Original comment by andreas....@gmail.com
on 18 Oct 2013 at 5:05
Actually the MemoryPool class uses weak references. So it only does
deduplication for as long as there's an instance of the underlying Transaction
referenced elsewhere. Once the last non-MemoryPool reference is gone, the
MemoryPool will automatically clean itself up and the Transaction will be freed.
Original comment by hearn@google.com
on 21 Oct 2013 at 9:25
Suggestion for rename: TransactionFactory
Original comment by andreas....@gmail.com
on 5 Nov 2013 at 9:01
It's not a factory though. I think TransactionTable is a better name.
Original comment by hearn@google.com
on 5 Nov 2013 at 10:30
Original issue reported on code.google.com by
hearn@google.com
on 18 Oct 2013 at 4:51