DyMeLoR: Dynamic Memory Logger and Restorer library for optimistic simulation objects with generic memory layout