Package-level declarations

Types

Link copied to clipboard
class Inventory

A compressed internal representation of an inventory, to be transmitted with the various inventory update packets. Rather than use a List, we pool these Inventory instances to avoid generating significant amounts of garbage. For a popular server, it is perfectly reasonable to expect north of a gigabyte of memory to be wasted through List instances in the span of an hour. We eliminate all garbage generation by using soft-reference pooled inventory objects. While this does result in a small hit due to the synchronization involved, it is nothing compared to the hit caused by garbage collection and memory allocation involved with inventories.

Link copied to clipboard
data object InventoryPool

A soft-reference based pool of Inventory objects, with the primary intent being to avoid re-creating lists of objs which end up wasting as much as 137kb of memory for a single inventory that's up to 5713 objs in capacity. While it is unlikely that any inventory would get near that, servers do commonly expand inventory capacities to numbers like 2,000 or 2,500, which would still consume up 48-60kb of memory as a result in any traditional manner.