473,396 Members | 1,967 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Memory management in .Net framework

i'm reading some books on memory mgmt in .Net framework. And here is my
understanding: The memory for each object in .Net comes from managed heap.
The GC is in charge of collecting unused memory and reclaiming memory
automatically.

My questions is for value type variable, is the memory still from managed
heap ?
and what happens if the value type variable is not in use, such as function
exits ?

Your explanation would be appreciated!
Nov 21 '05 #1
7 998
Nicole,

In Net does the value type "variable" not exist.

Although you can say that an object with a value in it is almost a variable.
(Don't try to use it that way we have seen in this newgroup often people
comming from VB6 who tried that, it has no benefits.)

An object is always on the managed heap.

When a value is not in an object it stays in the program stack

The GC is in charge to collect unused objects from the managed heap and
reclaiming memory from that.

When a value is in a method, than it is deleted from the stack as soon as
the method is done.

When the value is created as whatever global (static) value in a class it
stays as long as the class exists.

When a value or an object is in a shared procedure or a module, it lifes as
long as the application runs.

I hope this gives some ideas?

Cor

"Nicole" <Ni****@discussions.microsoft.com>
i'm reading some books on memory mgmt in .Net framework. And here is my
understanding: The memory for each object in .Net comes from managed heap.
The GC is in charge of collecting unused memory and reclaiming memory
automatically.

My questions is for value type variable, is the memory still from managed
heap ?
and what happens if the value type variable is not in use, such as
function
exits ?

Your explanation would be appreciated!

Nov 21 '05 #2
"Cor Ligthert" <no************@planet.nl> schrieb:
In Net does the value type "variable" not exist.


I assume Nicole is referring to variables declared in a type that is a value
type, like 'Dim i As Integer'.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 21 '05 #3
>
I assume Nicole is referring to variables declared in a type that is a
value type, like 'Dim i As Integer'.

Not impossible however than there is in my opinion still nothing wrong in my
anser.

Cor
Nov 21 '05 #4
correction it is see my correction..
Nov 21 '05 #5
Nicole,

I mix forever that variable when it is asked with the vb6 variant.

So you can skip the first row of my answer altough when you change in that
variable for variant than it is again right, however not that important.

Cor
C0**********@microsoft.com...
i'm reading some books on memory mgmt in .Net framework. And here is my
understanding: The memory for each object in .Net comes from managed heap.
The GC is in charge of collecting unused memory and reclaiming memory
automatically.

My questions is for value type variable, is the memory still from managed
heap ?
and what happens if the value type variable is not in use, such as
function
exits ?

Your explanation would be appreciated!

Nov 21 '05 #6
thanks,

:-)

Cor
Nov 21 '05 #7
Herfried is right. I mean the value type variable.
But thanks for your threads. I now have a better understanding.

Thanks again!

"Cor Ligthert" wrote:
Nicole,

I mix forever that variable when it is asked with the vb6 variant.

So you can skip the first row of my answer altough when you change in that
variable for variant than it is again right, however not that important.

Cor
C0**********@microsoft.com...
i'm reading some books on memory mgmt in .Net framework. And here is my
understanding: The memory for each object in .Net comes from managed heap.
The GC is in charge of collecting unused memory and reclaiming memory
automatically.

My questions is for value type variable, is the memory still from managed
heap ?
and what happens if the value type variable is not in use, such as
function
exits ?

Your explanation would be appreciated!


Nov 21 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Mike P | last post by:
I know everything about reference counting and making sure you don't have large objects lying around. I have also profiled my app with multiple tools. I know about the fact GC collects memory but...
8
by: Chad | last post by:
hello, i am losing memory each time i make this call to a C++ dll (I make frequent calls). 'in VB.Net Declare Function grab Lib "grabber.dll" _ (ByRef lpBuf As Byte, ByVal lnum As Integer)...
18
by: Mike P | last post by:
I know everything about reference counting and making sure you don't have large objects lying around. I have also profiled my app with multiple tools. I know about the fact GC collects memory but...
2
by: Larry | last post by:
I am wondering if anyone has any thoughts on the following issues once Ajax is incorporated into a page: Now that we have this Ajax stuff, users have the potential to not leave a page for a long...
5
by: RobbGMelenyk | last post by:
I've got a Windows Service written in C# that is having some unfortunate memory issues. I've been working with .NET MemProfiler and AllocationProfiler. But you don't have to use those programs to...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.