c# - Is separate memory allocated for functions and properties of an object? -
this question .net think applies generally. when new object instantiated, functions in object allocated memory too? if not called till later point?
put differently, 2 classes same member variables 1 more methods inside occupy more memory @ time of instantiation?
object instance rapresnts state of instance allocated. holds copy of fields , properties define inside correposndint type.
methods define given type stay in datastructure, out instance itself, called method table. every single instance allocate has pointer inside points type's method table.
when call function on method, shifts pointer necessary amount of addresses, pull function, push on stack arguments available in memory, , calls function.
more on can read here: drill .net framework internals see how clr creates runtime objects
Comments
Post a Comment