ControlMem() to grant and revoke write access to memory pages. You can also use ControlMem() to transfer
ownership of memory pages to other tasks:
Err ControlMem( void *p, int32 size, int32 cmd, Item task )cmd argument is MEMC_GIVE, the call gives the memory pages to the task specified by the task argument. In this case, the p argument, a pointer to a memory location, and the size argument, the amount of the contiguous memory, in bytes, beginning at the memory location specified by the p argument, together specify the memory to give away. If these two arguments specify any part of a page, the entire page is given away.
You can also give memory pages back to the kernel-and thereby return them to the system-wide free memory pool-by calling ControlMem() as described here, but with 0 as the value of the task argument. Memory pages can be returned to the kernel automatically when a task calls the ScavengeMem() function described in Reclaiming Memory for Other Tasks.