Skip to content

Heap

HeapΒΆ

Heap can store data with a size unknown at [[compile time]] or a size that might change instead.

For example, in the [[String]] the [[push_str]] method.

The heap is less organised.

The [[Operating System]] finds an empty spot somewhere in the heap that is big enough, marks it as being in use.

When used, returns a [[pointer]], which addresses a location in memory.

This process is called [[allocating on the heap]].


Allocating a large amount of space on the heap can take time.