сколько занимает в памяти object?
От: Kleeo Россия  
Дата: 23.10.04 18:43
Оценка:
Кто может подсказать сколько места в памяти занимает обьект типа Object. мне CLRProfiler показывает что 12 байт... вот я и думаю может я не там смотрю.... по моим подсчетам он должен занимать 4 байта...
Re: сколько занимает в памяти object?
От: Mab Россия http://shade.msu.ru/~mab
Дата: 23.10.04 18:50
Оценка: 4 (2)

In .NET version 1.0, each heap-allocated object consists of a 4 byte objectheader and 4 byte pointer to a method table. The 4 byte object header provides five bit flags, one of which is reserved for the garbage collector to mark an object as reachable and not free space. The remaining bits refer to a 27 bit index called a syncindex, which may refer to another table. This index has multiple purposes: As implied by its name it is used for synchronization, whenever the "lock" keyword is used. It is also used as the default hash code for Object.GetHashCode(). It does not provide the best distribution properties for a hash code, but it meets the minimum requirements for a hash code for reference equality. The syncindex remains constant throughout the life of the object.

http://www.codeproject.com/dotnet/strings.asp
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.