Allocate a buffer of the correct size for datType