When attempting to boot a non-existing database with the in-memory back end, a DataStore is created and referenced by a map. Since the database doesn't exist, Derby won't use the DataStore again and it will hang around indefinitely in VFMemoryStorageFactory (or until the same database is actually created, in which case the data store will be used).
FYI, storage factory instances are instantiated liberally, including for the same service (i.e. six instances of VFMemoryStorageFactory may be created to boot "jdbc:derby:memory:myDB").
- is related to
DERBY-4428 Add proper delete mechanism for in-memory databases