Nanoscale memory devices