Hi there!
Is there any way how can I stop garbage collection for a period of time.
Lets say, I have a form. Before form load I pause the GC and when the form
is shown resume GC 12 2264
I don't think so.
What would happen if one app stops GC and never starts it again?
--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com www.rthand.com
"Vadym Stetsyak" <pd****@ukr.net > wrote in message
news:e6******** *****@TK2MSFTNG P12.phx.gbl... Hi there!
Is there any way how can I stop garbage collection for a period of time.
Lets say, I have a form. Before form load I pause the GC and when the form is shown resume GC
One app thats leaking alot of memory :D
"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
news:OP******** *****@TK2MSFTNG P12.phx.gbl... I don't think so. What would happen if one app stops GC and never starts it again?
-- Miha Markic [MVP C#] - RightHand .NET consulting & software development miha at rthand com www.rthand.com
"Vadym Stetsyak" <pd****@ukr.net > wrote in message news:e6******** *****@TK2MSFTNG P12.phx.gbl... Hi there!
Is there any way how can I stop garbage collection for a period of time.
Lets say, I have a form. Before form load I pause the GC and when the
form is shown resume GC
hmm, AFAIK Garbage Collector operates in the managed heap and every .NET app
has its own heap, so I can assume that every heap has its own collector.
"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
news:OP******** *****@TK2MSFTNG P12.phx.gbl... I don't think so. What would happen if one app stops GC and never starts it again?
-- Miha Markic [MVP C#] - RightHand .NET consulting & software development miha at rthand com www.rthand.com
"Vadym Stetsyak" <pd****@ukr.net > wrote in message news:e6******** *****@TK2MSFTNG P12.phx.gbl... Hi there!
Is there any way how can I stop garbage collection for a period of time.
Lets say, I have a form. Before form load I pause the GC and when the
form is shown resume GC
Hi,
there is only one managed heap AFAIK.
Ask yourself, if every application has it's own heap, why would the garbage
collector need one ?
They are one and the same. If you are creating objects, memory comes from
the managed heap.
If you stop using those objects, the garbage collector reclaims this memory
(eventually).
BTW, why would you want to stop the garbage collector while creating the
form ?
Have you ever noticed the presence of the garbage collector (with regard to
performance, memory usage is another issue) ?
Greetings,
Bram.
"Vadym Stetsyak" <pd****@ukr.net > wrote in message
news:uh******** ******@TK2MSFTN GP11.phx.gbl... hmm, AFAIK Garbage Collector operates in the managed heap and every .NET
app has its own heap, so I can assume that every heap has its own collector. "Miha Markic [MVP C#]" <miha at rthand com> wrote in message news:OP******** *****@TK2MSFTNG P12.phx.gbl... I don't think so. What would happen if one app stops GC and never starts it again?
-- Miha Markic [MVP C#] - RightHand .NET consulting & software development miha at rthand com www.rthand.com
"Vadym Stetsyak" <pd****@ukr.net > wrote in message news:e6******** *****@TK2MSFTNG P12.phx.gbl... Hi there!
Is there any way how can I stop garbage collection for a period of
time. Lets say, I have a form. Before form load I pause the GC and when the form is shown resume GC
Hi Barn,
What do you mean "there is only one managed heap"?
What if two application run in different processes how do you expect them to
sare the same memory.
In a 32 bit machine a process can access 4GB flat address space. Normaly
windows application can use 2GB of them so if my all .NET application share
2GB or 4GB how many application can I run at the same time?
Of course using *file mapping* technique one can share a lot more memory
between precesses, but I don't thing this is the way GC works.
It might be (I'm not sure) that all application domains in the same process
to share the same managed heap. But it is for sure that not all .NET
application in the system share the same heap.
However for the original post; I don't thing you are able to stop the GC and
I don't see any reason to do that.
If you have any problems it might be something wrong with your application.
Would you give more information about your problem if you have any?
If you are concerned about performance don't be. IMHO GC is well optimized
and in normal conditions you shouldn't feel its exisitence.
B\rgds
100
"Bram" <bv*****@nospam .skynet.be> wrote in message
news:40******** **************@ news.skynet.be. .. Hi,
there is only one managed heap AFAIK. Ask yourself, if every application has it's own heap, why would the
garbage collector need one ? They are one and the same. If you are creating objects, memory comes from the managed heap. If you stop using those objects, the garbage collector reclaims this
memory (eventually).
BTW, why would you want to stop the garbage collector while creating the form ? Have you ever noticed the presence of the garbage collector (with regard
to performance, memory usage is another issue) ?
Greetings,
Bram.
"Vadym Stetsyak" <pd****@ukr.net > wrote in message news:uh******** ******@TK2MSFTN GP11.phx.gbl... hmm, AFAIK Garbage Collector operates in the managed heap and every .NET app has its own heap, so I can assume that every heap has its own collector. "Miha Markic [MVP C#]" <miha at rthand com> wrote in message news:OP******** *****@TK2MSFTNG P12.phx.gbl... I don't think so. What would happen if one app stops GC and never starts it again?
-- Miha Markic [MVP C#] - RightHand .NET consulting & software
development miha at rthand com www.rthand.com
"Vadym Stetsyak" <pd****@ukr.net > wrote in message news:e6******** *****@TK2MSFTNG P12.phx.gbl... > Hi there! > > Is there any way how can I stop garbage collection for a period of time. > > Lets say, I have a form. Before form load I pause the GC and when
the form > is shown resume GC > > >
My form involves great number of references, and the number of weak
references is rather big, so when the form is loading GC is also working
thus slowing down the form load process... there is only one managed heap AFAIK. Ask yourself, if every application has it's own heap, why would the
garbage collector need one ? They are one and the same. If you are creating objects, memory comes from the managed heap. If you stop using those objects, the garbage collector reclaims this
memory (eventually).
AFAIK every .NET application starts CLR host, which resides in the windows
process. And therefore memory of this process is shared only for tha
appdomains in that process. I can hardly imagine the GC, that is looking in
the memory of other processes and builds the graph of objects currently in
the heap.
Hi,
"Stoitcho Goutsev (100) [C# MVP]" <10*@100.com> wrote in message
news:uD******** ******@TK2MSFTN GP09.phx.gbl... Hi Barn, What do you mean "there is only one managed heap"?
I was referring to a single process. Every .NET application process has its
own and only one managed heap. Two different processes won't share the same
heap, as you also mentioned.
Two or more application domains will use the same heap, as memory is managed
and no single application can corrupt the heap and take all the other
applications down with it. That's how things might be in the future. If we
now launch a .NET application, a new .NET runtime engine is created to run
the app. That's why every (.NET) process takes at least 8 MB of memory or
even more. In the future, I guess, two or more applications might get
loaded into the same runtime engine (different domain though) when they (MS)
change the loader. This way they can share the framework assemblies to
preserve memory (a different way of code sharing). But that's all a guess.
Anybody real facts about this ?
Sorry for any confusion.
Greetings,
Bram.
What if two application run in different processes how do you expect them
to sare the same memory. In a 32 bit machine a process can access 4GB flat address space. Normaly windows application can use 2GB of them so if my all .NET application
share 2GB or 4GB how many application can I run at the same time? Of course using *file mapping* technique one can share a lot more memory between precesses, but I don't thing this is the way GC works. It might be (I'm not sure) that all application domains in the same
process to share the same managed heap. But it is for sure that not all .NET application in the system share the same heap.
However for the original post; I don't thing you are able to stop the GC
and I don't see any reason to do that. If you have any problems it might be something wrong with your
application. Would you give more information about your problem if you have any? If you are concerned about performance don't be. IMHO GC is well
optimized and in normal conditions you shouldn't feel its exisitence.
B\rgds 100
"Bram" <bv*****@nospam .skynet.be> wrote in message news:40******** **************@ news.skynet.be. .. Hi,
there is only one managed heap AFAIK. Ask yourself, if every application has it's own heap, why would the garbage collector need one ? They are one and the same. If you are creating objects, memory comes
from the managed heap. If you stop using those objects, the garbage collector reclaims this memory (eventually).
BTW, why would you want to stop the garbage collector while creating the form ? Have you ever noticed the presence of the garbage collector (with regard to performance, memory usage is another issue) ?
Greetings,
Bram.
"Vadym Stetsyak" <pd****@ukr.net > wrote in message news:uh******** ******@TK2MSFTN GP11.phx.gbl... hmm, AFAIK Garbage Collector operates in the managed heap and every
..NET app has its own heap, so I can assume that every heap has its own
collector.
"Miha Markic [MVP C#]" <miha at rthand com> wrote in message news:OP******** *****@TK2MSFTNG P12.phx.gbl... > I don't think so. > What would happen if one app stops GC and never starts it again? > > -- > Miha Markic [MVP C#] - RightHand .NET consulting & software development > miha at rthand com > www.rthand.com > > "Vadym Stetsyak" <pd****@ukr.net > wrote in message > news:e6******** *****@TK2MSFTNG P12.phx.gbl... > > Hi there! > > > > Is there any way how can I stop garbage collection for a period of
time. > > > > Lets say, I have a form. Before form load I pause the GC and when the form > > is shown resume GC > > > > > > > >
Hi,
"Vadym Stetsyak" <pd****@ukr.net > wrote in message
news:uK******** ******@TK2MSFTN GP10.phx.gbl... My form involves great number of references, and the number of weak references is rather big, so when the form is loading GC is also working thus slowing down the form load process...
Are you sure the GC is running when a form is being loaded ? Could be.
They might trigger a garbage collection when you are about to do something
intensive, like loading a form, so you don't notice the collection.
Brilliant cover up.
Don't think you'll ever notice the collector running, or not in any normal
application. Might be noticeable in some real-time applications which use a
lot of memory.
BTW, what is your memory usage when the form has been loaded ?
Greetings,
Bram there is only one managed heap AFAIK. Ask yourself, if every application has it's own heap, why would the garbage collector need one ? They are one and the same. If you are creating objects, memory comes
from the managed heap. If you stop using those objects, the garbage collector reclaims this memory (eventually).
AFAIK every .NET application starts CLR host, which resides in the windows process. And therefore memory of this process is shared only for tha appdomains in that process. I can hardly imagine the GC, that is looking
in the memory of other processes and builds the graph of objects currently in the heap.
Hi Bram,
All application domains in the same process use the same mamory that is
true. Because they are managed (checked when compiled by the JITter) they
won't write in the memory addresses they are not supposed to write. However
it doesn't imply that they use the same managed heap as a structure. The
could use one heap of course. What I'm saing is that I haven't read
(actually I haven't ask my self that question) whether the heap is one or
each domain has its own. And I thing it is not important since application
domains cannot share memory.
Right now you cannot start two application in the same process using windows
loader, but you can start different application in the same process as a new
application domain from within the process (from application domain already
running in the process) Then they will share the same framework assemblies
because those assembies are loaded application neutral.
B\rgds
100
"Bram" <bv*****@nospam .skynet.be> wrote in message
news:40******** *************@n ews.skynet.be.. . Hi,
"Stoitcho Goutsev (100) [C# MVP]" <10*@100.com> wrote in message news:uD******** ******@TK2MSFTN GP09.phx.gbl... Hi Barn, What do you mean "there is only one managed heap"? I was referring to a single process. Every .NET application process has
its own and only one managed heap. Two different processes won't share the
same heap, as you also mentioned. Two or more application domains will use the same heap, as memory is
managed and no single application can corrupt the heap and take all the other applications down with it. That's how things might be in the future. If
we now launch a .NET application, a new .NET runtime engine is created to run the app. That's why every (.NET) process takes at least 8 MB of memory or even more. In the future, I guess, two or more applications might get loaded into the same runtime engine (different domain though) when they
(MS) change the loader. This way they can share the framework assemblies to preserve memory (a different way of code sharing). But that's all a
guess. Anybody real facts about this ?
Sorry for any confusion. Greetings,
Bram.
What if two application run in different processes how do you expect
them to sare the same memory. In a 32 bit machine a process can access 4GB flat address space. Normaly windows application can use 2GB of them so if my all .NET application share 2GB or 4GB how many application can I run at the same time? Of course using *file mapping* technique one can share a lot more memory between precesses, but I don't thing this is the way GC works. It might be (I'm not sure) that all application domains in the same process to share the same managed heap. But it is for sure that not all .NET application in the system share the same heap.
However for the original post; I don't thing you are able to stop the GC and I don't see any reason to do that. If you have any problems it might be something wrong with your application. Would you give more information about your problem if you have any? If you are concerned about performance don't be. IMHO GC is well optimized and in normal conditions you shouldn't feel its exisitence.
B\rgds 100
"Bram" <bv*****@nospam .skynet.be> wrote in message news:40******** **************@ news.skynet.be. .. Hi,
there is only one managed heap AFAIK. Ask yourself, if every application has it's own heap, why would the garbage collector need one ? They are one and the same. If you are creating objects, memory comes from the managed heap. If you stop using those objects, the garbage collector reclaims this memory (eventually).
BTW, why would you want to stop the garbage collector while creating
the form ? Have you ever noticed the presence of the garbage collector (with
regard to performance, memory usage is another issue) ?
Greetings,
Bram.
"Vadym Stetsyak" <pd****@ukr.net > wrote in message news:uh******** ******@TK2MSFTN GP11.phx.gbl... > hmm, AFAIK Garbage Collector operates in the managed heap and every .NET app > has its own heap, so I can assume that every heap has its own collector. > > > > "Miha Markic [MVP C#]" <miha at rthand com> wrote in message > news:OP******** *****@TK2MSFTNG P12.phx.gbl... > > I don't think so. > > What would happen if one app stops GC and never starts it again? > > > > -- > > Miha Markic [MVP C#] - RightHand .NET consulting & software development > > miha at rthand com > > www.rthand.com > > > > "Vadym Stetsyak" <pd****@ukr.net > wrote in message > > news:e6******** *****@TK2MSFTNG P12.phx.gbl... > > > Hi there! > > > > > > Is there any way how can I stop garbage collection for a period
of time. > > > > > > Lets say, I have a form. Before form load I pause the GC and
when the > form > > > is shown resume GC > > > > > > > > > > > > > > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: engsol |
last post by:
I'm using Python to parse a bunch of s/w test files and make csv files for later report generation by MS ACCESS....(my boss
loves the quick turn-around compared to C). Each log file may contain one or more 'sessions', and each session may contain
one or more 'nodes'.
Each session in the log has an ASCII start and stop time, as does each node.
I have the basic parse part done for parameters, errors, etc., but noticed my routine for...
|
by: Eric Osman |
last post by:
My javascript program has reason to want to stop.
For example, function A has 5 lines, the second of which calls function
B, which has 5 lines, the first of which calls function C.
But function C discovers that something is very wrong so it does an
"alert" saying something like
Sorry, couldn't make the necessary connection
|
by: Paul O. Morris |
last post by:
Is there a script that I can run to stop a particular SQL server service on
Win2003 server? I'm looking for a similar script to restart that service as
well. Thanks.
|
by: Adrian MacNair |
last post by:
Hi I need some help if anyone can understand my crap javascript. The problem
is that after the slideshow ends (reaches the end of array) it should stop,
but the timeout doesn't clear and I can see the layer flashing.
I wrote a slideshow script. When you click a hypertext link it calls the
function speed() and passes the variable 5000:
var myvar = 0;
// Starting variable at zero
var myTimeout;
|
by: Prasad |
last post by:
Hi,
I am writing a service which takes a long time to stop after the OnStop
call is given by the Services Snap-in. The problem is I cannot cut down on
the time that it takes to Stop. The Service snap-in gives me the error
saying that the service did not respond to the Stop call in a timely
fashion. So is there any method by which I can get around this problem.
Thanks
Prasad
| |
by: deko |
last post by:
I have a sub routine that searches the Outlook PST for a message sent
to/from a particular email address. Obviously, this can take a long time
when the PST contains thousands of messages. I'd like to put a button on my
Access 20003 form that will stop the sub routine when clicked. I know I can
press Ctl + Break and stop the code, but is there a more graceful way to do
this programmatically? Should I use SendKeys?
Also, it would be...
|
by: Jacobus Terhorst |
last post by:
Using C#:
I tried:
ServiceController me = new ServiceController(this.ServiceName);
me.Stop();
it raises an exception: Cannot find Service
I also tried:
|
by: Matt Theule |
last post by:
While stepping through an ASP.NET project, I found that data was being
inserted into my database even though I was not stepping through the
code that inserted the data.
I have a single page with inline code. The page has a Datagrid, a
textbox and a button. When the button is clicked, the value of the
textbox is inserted into the table whose contents are displayed on the
page.
The problem occurs when I set a breakpoint on a line *IN*...
|
by: shai |
last post by:
I am working at .net 1.1, writing in c#.
I have windows service with a COM object.
Every unexpected time The COM object throw an error that make my service get
stuck (do not respond).
I can catch this error.
I want to restart my windows service every time the COM object throws an
error.
I use System.ServiceProcess.ServiceController to stop and start my service.
But there is one thing I do not understand:
|
by: mattcfisher |
last post by:
Hi,
I have two windows services running together. One is the main
program, and one is an "updater" wrapper for the main. The updater
service starts and stops the main one (as in you should never start or
stop main service manually, only updater).
On most computers it works great, the updater's onStop() can start and
stop the main service perfectly. On some computers, though, the
updater hangs when it tries to stop the main service. It...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |