Share via


SDCreateMemoryList (Compact 2013)

3/26/2014

This function creates a memory look-aside list.

Syntax

SD_MEMORY_LIST_HANDLE SDCreateMemoryList(
  ULONG Tag,
  ULONG Depth,
  ULONG EntrySize
);

Parameters

  • Tag
    [in] Reserved.
  • Depth
    [in] Threshold of committed memory list size.
  • EntrySize
    [in] Size of each entry.

Return Value

Returns a handle to the memory list. The handle can be used to allocate and free entries from the memory list. Returns NULL if the memory list could not be created.

Remarks

This function creates a memory look-aside list containing initial entries equal to the Depthparameter. The look-aside list provides a driver with a method of pre-allocating and recycling often-used memory blocks. The driver can retrieve these memory blocks from the list, using the SDAllocateFromMemList function. Blocks are freed back to the list using the SDFreeToMemList function. Freed blocks are added back to the memory list rather than returned to the system heap. If the memory list is empty, additional blocks are allocated from the heap. These additional blocks are freed back to the heap in order to allow the memory list to return to its normal depth. When allocating blocks, a driver should not assume that the blocks are zero initialized.

A driver can use the SDDeleteMemList function to delete a memory list. The driver must return all allocations back to the memory list before deleting the memory list, or a memory leak will occur.

Requirements

Header

sdcardddk.h

Library

sdcardlib.lib

See Also

Reference

Secure Digital (SD) Card Driver Functions
SDAllocateFromMemList
SDFreeToMemList
SDDeleteMemList