Results 1 to 4 of 4

Thread: Size of a referenc in C#?

  1. #1

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Size of a referenc in C#?

    Say that I do something like this on a Win XP 32bit machine in Visual Studio 03/05:

    Code:
    MyClass object1 = new MyClass();
    MyClass object2 = object1;

    how much memory does object2 use? 32bit? Or does it hold RTTI info and more too?


    Thanks
    - ØØ -

  2. #2

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: Size of a referenc in C#?

    I am not sure if I belive in it, but this is what I have found so far:


    http://www.developerfusion.co.uk/show/4705/
    (On the 32-bit version of .NET, for instance, a reference type variable's slot is always just 4 bytes.)

    - ØØ -
    Last edited by NoteMe; Aug 29th, 2005 at 07:21 AM.

  3. #3
    Frenzied Member moinkhan's Avatar
    Join Date
    Jun 2000
    Location
    Karachi, Pakistan
    Posts
    2,011

    Re: Size of a referenc in C#?

    as the reference is a pointer to the address of the object.. it should be 32-bit for 32-bit platforms.

  4. #4

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: Size of a referenc in C#?

    So what makes it type safe? Isn't there any RTTI info stored? How does it know it is of type MyClass, and not an other type of pointer?


    - ØØ -

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width