Export (0) Print
Expand All

ICorProfilerInfo::GetObjectSize Method

Gets the size of a specified object.

HRESULT GetObjectSize(
    [in]  ObjectID objectId,
    [out] ULONG  *pcSize);

objectId

[in] The ID of the object.

pcSize

[out] A pointer to the object's size, in bytes.

Important note Important

This method is obsolete. It returns COR_E_OVERFLOW for objects greater than 4GB on 64-bit platforms. Use the ICorProfilerInfo4::GetObjectSize2 method instead.

Different objects of the same types often have the same size. However, some types, such as arrays or strings, may have a different size for each object.

The size returned by the GetObjectSize method does not include any alignment padding that may appear after the object is on the garbage collection heap. If you use the GetObjectSize method to advance from object to object on the garbage collection heap, add alignment padding manually, as necessary.

  • On 32-bit Windows, COR_PRF_GC_GEN_0, COR_PRF_GC_GEN_1, and COR_PRF_GC_GEN_2 use 4-byte alignment, and COR_PRF_GC_LARGE_OBJECT_HEAP uses 8-byte alignment.

  • On 64-bit Windows, the alignment is always 8 bytes.

Platforms: See .NET Framework System Requirements.

Header: CorProf.idl, CorProf.h

Library: CorGuids.lib

.NET Framework Versions: 4.5, 4, 3.5 SP1, 3.5, 3.0 SP1, 3.0, 2.0 SP1, 2.0

Show:
© 2014 Microsoft