fix MemoryError and add a macro to delete configuration objects