---
title: IOMallocZero
framework: driverkit
role: symbol
role_heading: Function
path: driverkit/iomalloczero
---

# IOMallocZero

Allocates the specified amount of general-purpose memory and zero-initializes it.

## Declaration

```occ
void *IOMallocZero(size_t length);
```

## Parameters

- `length`: The number of bytes to allocate.

## Return Value

Return Value A pointer to the allocated memory block, or NULL on failure.

## Discussion

Discussion This is a general-purpose utility to allocate memory, and initialize that memory to zero. There are no alignment guarantees on the returned memory, and alignment may vary depending on the configuration. To allocate memory for use in I/O transfers, create an IOBufferMemoryDescriptor instead.

## See Also

### Allocation

- [IONew](driverkit/ionew.md)
- [IONewZero](driverkit/ionewzero.md)
- [IOMalloc](driverkit/iomalloc.md)
- [OSTypeAlloc](driverkit/ostypealloc.md)
