Memory Consumption
-
string str = null; can u tell, In the above line of code, what shall be teh memory consumption by the variable str
Well, str is a reference type which doesn't reference anything, so it will be just the size of reference itself. I think this will be 4 bytes for the reference itself, and a further 8 for synchronisation and other .NET internal stuff. So, likely 12 bytes.
Regards, Rob Philpott.
-
Well, str is a reference type which doesn't reference anything, so it will be just the size of reference itself. I think this will be 4 bytes for the reference itself, and a further 8 for synchronisation and other .NET internal stuff. So, likely 12 bytes.
Regards, Rob Philpott.
-
Rob Philpott wrote:
and a further 8 for synchronisation and other .NET internal stuff.
Can u please tell where should i read the detailed meaning of the above quoted line ?
Actually, I got that wrong. The extra 8 bytes would be on the heap if your reference was not null. So, just 4 bytes on a 32bit machine. Trying to find a good reference for this stuff now.
Regards, Rob Philpott.
-
Rob Philpott wrote:
and a further 8 for synchronisation and other .NET internal stuff.
Can u please tell where should i read the detailed meaning of the above quoted line ?
Can't find anything on the net I'm afraid. I'm sure there's lots out there if you look around though. Also, consider reading one of Jeffrey Richters books - they are excellent on this sort of stuff.
Regards, Rob Philpott.
-
Can't find anything on the net I'm afraid. I'm sure there's lots out there if you look around though. Also, consider reading one of Jeffrey Richters books - they are excellent on this sort of stuff.
Regards, Rob Philpott.