we have a use case where we need to load hundreds of objects with the ObjectSwapper. That works fine, but is slow, because each of those objects is a single dump (we cannot change that) and therefore after each loaded object a memory segment is freed (invoked from ObjectSwapper>>#deleteSegments:). Deleting a memory segment is a VM function, which really takes a long time (even on a current system, I can only delete about 20 to 30 memory segments per second).
My question is: Can another (faster) function be used to get rid of the memory segment? We tried EsMemorySegment>>invalidate instead (which is normally used during image loading). That performs much faster, but the application will crash (typically on shutdown). Our guess is that EsMemorySegment>>delete does a lot of work to get rid of all object pointers and so on, which is probably not needed in the special case of the ObjectSwapper (because all objects have been extracted from that memory segment), so at least in theory a faster alternative should exist.
Any thoughts on that?
Ciao and thanks, Michael
BTW: As a kind of workaround I implemented lazy memory segment deletion in the ObjectSwapper. That means the segments are collected and are only destroyed when the CPU is free (or an upper limit of used memory is reached). Do you see any problems with such an approach?