memory usage optimizations for read and write operations

We usually use ```palloc0(count * sizeof(type))``` instead of ```palloc0(sizeof(type) * count))```.