memory usage optimizations for read and write operations