# ScavengeMem

Returns task's free memory pages to the system memory pool.

### Synopsis

`int32 ScavengeMem( void )`

### Description

This procedure finds pages of memory in the task's free memory pool from which no memory is allocated and returns those pages to the system-wide memory pool.

If there is not enough memory in a task's free memory pool to satisfy a memory-allocation request, `AllocMem()` tries to get reclaim the necessary memory by calling `ScavengeMem()`.

### Return Value

The procedure returns the amount of memory that was returned to the system-wide memory pool, in bytes. If no memory was returned, the procedure returns 0.

### Implementation

Folio call implemented in kernel folio V20.

### Associated Files

mem.h
  ANSI C Prototype

clib.lib
  ARM Link Library

### See Also

``AllocMem`(), AllocMemFromMemLists(), FreeMem(), FreeMemToMemLists()`

#