Admin Production ni-theme
Current Publication

ListPreAllocate

LabWindows/CVI

ListPreAllocate

int ListPreAllocate (ListType list, size_t numOfItemsToPreAllocate);

Purpose

This function reserves space in a list for the specified number of items. Doing this insures that the specified number of items can be inserted into the list without checking for failure due to insufficient memory or without the possibility of a performance hit from a memory allocation.

The number of items in the list (as returned by ListNumItems) is not changed.

This function is useful for simplifying the error handling in certain complex situations and for ensuring predictable list insertion performance during time critical operations.

Parameters

Input
Name Type Description
list ListType The list to pre–allocate space in.
numOfItemsToPreAllocate size_t The number of items to reserve space for in the list.

If ListPreAllocate succeeds, then this is the number of items that can be inserted into the list without the possibility of running out of memory.

Return Value

Name Type Description
result int Returns non–zero if the space for the specified number of items was allocated.

Returns zero (0) if an error occurs.

Additional Information

Library: Programmer's Toolbox

Include file: toolbox\toolbox.h

LabWindows/CVI compatibility: LabWindows/CVI 4.0 and later