Name

packer->allocate -- remove a rectangular region from the free space map

Synopsis

int packer->allocate ( object field area )

Description

This function takes the area defined by the single parameter and subtracts it from the current free space map. The function never fails, if the space isn't available, no changes are made to the free space map.

area must be a field object.

Allocate currently only has one policy it applies to fragmentation: "prefer vertical fragment". This may change in the future. After fragmentation, the free space map is examined and fragments that have a common border are joined into a single fragment.

Examples

See example-packer.php in the examples directory.

See Also

History

Added with the packer in 2.6

Bugs

"prefer vertical fragment" is pretty limited. At the least there should also be "prefer horizontal fragment" available. Even more fragmentation policies are available, and may be necessary to build any real intelligence into the packer.