We demonstrate that replacing the hydrazone linkage by a linear π-spacer bridging a carbazole donor and a naphthalimide acceptor induces a critical change in molecular organization and electron density distribution in the conjugation backbone that correlates with a remarkable variation of memory performance from DRAM to WORM types.