Use malloc and free instead of GC allocating inside (w)string.sort