---
title: allocate
framework: kernel
role: pseudoSymbol
path: kernel/iorangeallocator/1810255-allocate
---

# allocate

Allocates from the free list, at any offset.

## Declaration

```occ
virtual bool allocate(
 IORangeScalar size, 
 IORangeScalar *result, 
 IORangeScalar alignment = 0 ); 
```

## Parameters

- `size`: The size of the range requested.
- `result`: The beginning of the range allocated is returned here on success.
- `alignment`: If zero is passed, default to the allocators alignment, otherwise pass an alignment required for the allocation, for example 4096 to page align.

## Return Value

Return Value Returns true if the allocation was successful, else false.

## Overview

Overview This method allocates a range from the free list. The alignment will default to the alignment set when the allocator was created or may be set here.

## See Also

### Miscellaneous

- [allocateRange](kernel/iorangeallocator/1810314-allocaterange.md)
- [deallocate](kernel/iorangeallocator/1810361-deallocate.md)
- [getFragmentCapacity](kernel/iorangeallocator/1810407-getfragmentcapacity.md)
- [getFragmentCount](kernel/iorangeallocator/1810456-getfragmentcount.md)
- [getFreeCount](kernel/iorangeallocator/1810490-getfreecount.md)
- [init](kernel/iorangeallocator/1810534-init.md)
- [setFragmentCapacityIncrement](kernel/iorangeallocator/1810575-setfragmentcapacityincrement.md)
- [withRange](kernel/iorangeallocator/1810621-withrange.md)
