rename length to mem_length and suffer the consequences