FileUtil.secureDelete(tmpFile);
/* As opposed to the default, BTreeIDMapping uses an on-disk file instead of in-memory for mapping IDs.
/* Reduces memory usage during defragmentation while being slower.
/* However as of db4o 7.4.63.11890, it is bugged and prevents defragmentation from succeeding for my database, so we don't use it for now. */
final DefragmentConfig config = new DefragmentConfig(databaseFile.getAbsolutePath(),
backupFile.getAbsolutePath()
// ,new BTreeIDMapping(tmpFile.getAbsolutePath())
);
/* Delete classes which are not known to the classloader anymore - We do NOT do this because:
/* - It is buggy and causes exceptions often as of db4o 7.4.63.11890
/* - Freetalk has always had proper database upgrade code (function upgradeDB()) and does not rely on automatic schema evolution.
/* If we need to get rid of certain objects we should do it in the database upgrade code, */
// config.storedClassFilter(new AvailableClassFilter());
config.db4oConfig(getNewDatabaseConfiguration());
try {
Defragment.defrag(config);
} catch (Exception e) {
Logger.error(this, "Defragment failed", e);