Nanogap engineering of low-dimensional nanomaterials, has received considerable interest in a variety of fields, ranging from molecular electronics to memories. Creating nanogaps at a certain position is of vital importance for the repeatable fabrication of the devices. In this work, we report a rational design of non-volatile memories based on sub-5 nm nanogaped single-walled carbon nanotubes (SWNTs) via the electromechanical motion. The nanogaps are readily realized by electroburning in a partially suspended SWNTs device with nanoscale region. The SWNT memory devices are applicable for both metallic and semiconducting SWNTs, resolving the challenge of separation of semiconducting SWNTs from metallic ones. Meanwhile, the memory devices exhibit excellent performance: ultra-low writing energy (4.1*10-19 J per bit), ON/OFF ratio of 105, stable switching ON operations and over 30 hours retention time in ambient conditions, which are of great potential for applications.