Flexible memory devices are one of the most crucial elements in the wearable electronics. In this work, polyimides (PIs)-based flexible resistive memory devices with an excellent thermal and mechanical durability are demonstrated. Four kinds of functional PIs are derived from the heterocyclic diamines including 2,6-diaminodibenzo-p-dioxin (OODA) and 2,6-diaminothianthrene, and dianhydrides including 4,4′-(hexafluoroisopropylidene)diphthalic anhydride (6FDA) and 3,3′,4,4′-biphenyltetracarboxylic dianhydride. PI with diamine of OODA and dianhydride of 6FDA (PI(OODA_6FDA)) possesses outstanding thermal and mechanical properties with a high glass transition temperature of 352 °C, a low coefficient of thermal expansion of 28.1 ppm K −1 , and a high elongation at break of 10%. In addition, PI(OODA_6FDA)-based memory shows write-once-read-many behavior with a high on/off current ratio of 10 6 and a stable data retention, attributed to the donor-acceptor charge transfer between the polymer chains. The retained current levels at a low resistive state can be observed even with thermal treatment at 200 °C for 24 h or 1000 times cyclic bending at a bending radius of 5 mm. These results demonstrate the potential of heterocyclic PIs for flexible resistive memory.