Skip to content

Latest commit

 

History

History
79 lines (61 loc) · 2.41 KB

nf-objidl-imalloc-alloc.md

File metadata and controls

79 lines (61 loc) · 2.41 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:objidl.IMalloc.Alloc
IMalloc::Alloc (objidl.h)
Allocates a block of memory. (IMalloc.Alloc)
Alloc
Alloc method [COM]
Alloc method [COM]
IMalloc interface
IMalloc interface [COM]
Alloc method
IMalloc.Alloc
IMalloc::Alloc
_com_imalloc_alloc
com.imalloc_alloc
objidl/IMalloc::Alloc
com\imalloc_alloc.htm
com
c9c9bdac-965f-4b18-9338-28a025930480
12/05/2018
Alloc, Alloc method [COM], Alloc method [COM],IMalloc interface, IMalloc interface [COM],Alloc method, IMalloc.Alloc, IMalloc::Alloc, _com_imalloc_alloc, com.imalloc_alloc, objidl/IMalloc::Alloc
objidl.h
Windows
Windows 2000 Professional [desktop apps only]
Windows 2000 Server [desktop apps only]
ObjIdl.idl
Windows
19H1
IMalloc::Alloc
objidl/IMalloc::Alloc
c++
APIRef
kbSyntax
COM
ObjIdl.h
IMalloc.Alloc

IMalloc::Alloc

-description

Allocates a block of memory.

-parameters

-param cb [in]

The size of the memory block to be allocated, in bytes.

-returns

If the method succeeds, the return value is a pointer to the allocated block of memory. Otherwise, it is NULL.

Applications should always check the return value from this method, even when requesting small amounts of memory, because there is no guarantee the memory will be allocated.

-remarks

The initial contents of the returned memory block are undefined and there is no guarantee that the block has been initialized, so you should initialize it in your code. The allocated block may be larger than cb bytes because of the space required for alignment and for maintenance information.

If cb is zero, Alloc allocates a zero-length item and returns a valid pointer to that item. If there is insufficient memory available, Alloc returns NULL.

-see-also

CoTaskMemAlloc

IMalloc