|
I suggest you read Joseph Newcomer's excellent article How Big Is My Program?[^] Written for C++ apps, it still applies heavily to .NET applications.
The 'Mem Usage' column in Task Manager - which is the same as the 'Process: Working Set Size' counter in perfmon/System Monitor - shows the amount of physical memory currently allocated to your process. It's not quite that simple, though, as it includes all shared items (such as code in DLLs loaded into your process) that have been referenced recently.
The GC heap follows a fairly common pattern of making virtual memory allocations but not releasing those allocations back to the OS unless memory pressure or the amount of free memory is moderately high. This saves time in making allocations - altering the virtual memory map requires calls into kernel mode. So you'll tend to see the working set grow, in the general case.
Finally recall that a thread is not free. Memory must be allocated for the thread's user- and kernel-mode stacks and for any other per-thread data.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Mike Dimmick wrote:
I suggest you read Joseph Newcomer's excellent article How Big Is My Program?[^] Written for C++ apps, it still applies heavily to .NET applications.
Thanks for that.. I will be sure to check into it.
Mike Dimmick wrote:
The GC heap follows a fairly common pattern of making virtual memory allocations but not releasing those allocations back to the OS unless memory pressure or the amount of free memory is moderately high. This saves time in making allocations - altering the virtual memory map requires calls into kernel mode. So you'll tend to see the working set grow, in the general case.
yeah, I figured it might end up being something like this but I was ammazed to see it take so long. I ran an overnight test (7 hours) and did end up seeing where the memory was reclaimed after 6 hours. I just figured that GC would have an effect quicker than that.
Mike Dimmick wrote:
Finally recall that a thread is not free. Memory must be allocated for the thread's user- and kernel-mode stacks and for any other per-thread data.
I understand that as well, but what I did not expect to see was a memory creep up over several minutes then get release hours latter. I figured I would see an immediate increase in size right when the threads were created but not that I would ocntinue to see a creep up after that.
Thanks.
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Jörgen Sigvardsson wrote:
If the physicists find a universal theory describing the laws of universe, I'm sure the a**hole constant will be an integral part of that theory.
|
|
|
|
|
so maybe my problem (couple threads up) is that .NET returns shared memory in use by a other processes. Does anyone know how to compute a proper amount of memory like taskmanager does?
|
|
|
|
|
|
Hi,
Can someone tell me the way by which the 'obj' directory created to store temporary files in the .NET framework Ex.
%Project Directory%\obj\<configuration>
Can be changed to some other path.
Since the output directories can be changed from the properties page of the project, but is there any similar way by which the 'obj' diretory path can be changed
Appreciate all the help
Saleem
|
|
|
|
|
was trying to do this.
1. Spawn cmd.exe and have a dialog with it sending commands to it and getting the output.
I did all the relevant things . All those properties and things , But I cant read the output , or I think the process exits itself. The code I am trying is given below.
2. I was trying to spawn bitsadmin.exe with the argument /list but got this error .
BITSADMIN version 2.0 [ 6.6.2600.2180 ]
BITS administration utility.
(C) Copyright 2000-2004 Microsoft Corp.
Unable to get console input mode - 0x80070006
The handle is invalid.
// This is the the code I am using to try it out.
private void button1_Click(object sender, EventArgs e)
{
Process p = new Process();
ProcessStartInfo pInfo = new ProcessStartInfo();
pInfo.RedirectStandardOutput = true;
pInfo.RedirectStandardError = true;
pInfo.RedirectStandardInput = true;
pInfo.FileName = "bitsadmin.exe";
pInfo.Arguments = "/list";
pInfo.CreateNoWindow = true;
pInfo.UseShellExecute = false;
p.StartInfo = pInfo;
p.EnableRaisingEvents = true;
p.OutputDataReceived += new DataReceivedEventHandler(process1_OutputDataReceived);
p.ErrorDataReceived += new DataReceivedEventHandler(process1_ErrorDataReceived);
p.Exited += new EventHandler(process1_Exited);
p.Start ();
//p.StandardInput.WriteLine("dir");
}
private void process1_OutputDataReceived(object sender, DataReceivedEventArgs e)
{
this.Text = "process1_OutputDataReceived";
textBox1.Text += e.Data + "\n";
}
private void process1_ErrorDataReceived(object sender, DataReceivedEventArgs e)
{
this.Text = "process1_ErrorDataReceived";
textBox1.Text += e.Data + "\n";
}
private void process1_Exited(object sender, EventArgs e)
{
this.Text = "process1_Exited";
Process p = sender as Process;
textBox1.Text += p.StandardOutput.ReadToEnd() + "\n";
}
}
|
|
|
|
|
|
u did great job with the shell control , but unfortunately it did not work for me bcz I am using the same method to do things.
It turned out that the problem is with bitsadmin.
I spawned it from a console app and it did work fine.
Then I tried a workaround. I spawned a console app from my WinForms App and that Console App spawned Bitsadmin . But the Problem persists ... POOR ME
|
|
|
|
|
UGH! Why is this so hard?
It's not really hard, just annowuying that I have to do it.
All I want to do is copy one hashtable from here to there
dim firstHashtable as NewHashtable
dim secondHashtable as new Hashtable
firstHashtable.Add("Key1", "Value1")
firstHashtable.Add("key2", "Value2")
secondHashtable = firstHashtable
I don't want a shallow copy, or a shallow clone... no fancy shmancy pointer stuff.. all I want is is a second copy of the hashtable.
There is a Copy method, but noooooooooo, that copies the contents fo some funky array...
UGH!
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Jörgen Sigvardsson wrote:
If the physicists find a universal theory describing the laws of universe, I'm sure the a**hole constant will be an integral part of that theory.
|
|
|
|
|
If you just want a copy of the Hashtable, use the Clone method
<br />
secondHashtable = (Hashtable) firstHashtable.Clone();<br />
This will create a copy of the hashtable, but will *not* make a copy of the entries in the hashtable, they will be referring to the same object. If you want a copy of that too, try serializing and deserializing it to and from a MemoryStream. Something like
<br />
BinaryFormatter formatter = new BinaryFormatter();<br />
MemoryStream memoryStream = new MemoryStream();<br />
formatter.Serialize(memoryStream, firstHashtable);<br />
secondHashTable = (Hashtable) formatter.Deserialize(memoryStream);<br />
Regards
Senthil
My Blog
|
|
|
|
|
Hi,
I am trying to dynamically load assemblies from a Web Service but I am getting an exception telling me Access Denied. I'm not 100% on Trusting Assemblies and that is probably what is hurting me.
What do I need to do, to get the Web Service to call Activator.CreateInstance without this error?
Any help would be appreciated.
Cheers,
"If you're too careful, your whole life can become a f---in' grind." - Mike McD (Rounders)
|
|
|
|
|
i dont want to change my application to a console app because i dont want the console showing up whenever i run my application.
BUT..
i needed to have some commandline options to the application..
ex: my_app -e somefile.txt
i would now need to write to the console any error messages i would encouter.
is there a way to output to the console
like using Console.writeln("message"); when my application is a windows application?
thanks..
-- kaloy --
|
|
|
|
|
If you're not in a console application, and you're debugging, it'll forward to the debug output window. If you want to forward to some sort of stream (say a text file or network connection), you could use Console.SetOut. If you want the errors to display in a text box or something, the only method I've discovered so far is to make your own version of TextWriter that overrides the Write and WriteLine functions (there's a lot of them -- just do the ones you need), and Console.SetOut to that.
Actually, it might be interesting to make an article about this.
|
|
|
|
|
thanks..
but is there a way to display the messages on the same console that called the application?..
i dont need to forward it to other streams..
maybe i'll just have to save it to a file if i could NOT find a way to display it.
thanks anyway..
-- kaloy --
|
|
|
|
|
Sorry, I don't think I really understood what you're trying to do.
So you have a console application which calls a windowed application, and you want the Console.WriteLine calls from the windowed application to show up in the original console application?
|
|
|
|
|
sorry about the confusion..
i have a windows application. when i open the application from a command prompt (or a console). i need to display the error messages to the console.
the current behavior is no messages are displayed.
hope this clears things up
thanks for your time..
-- kaloy --
|
|
|
|
|
Compile this as a console program, call it "dump.exe" maybe.
<br />
using System;<br />
using System.IO;<br />
<br />
namespace Dump<br />
{<br />
class Class1<br />
{<br />
[STAThread]<br />
static void Main(string[] args)<br />
{<br />
char[] buffer = new char[512];<br />
int len;<br />
while((len = Console.In.Read(buffer, 0, 512)) != 0)<br />
Console.Write(buffer, 0, len);<br />
}<br />
}<br />
}<br />
<br />
When you call your program from the console, call it up like this: my_app -e somefile.txt | dump . This pipes the console output to dump.exe, which in turn displays it to the console.
Or, rather than using that dump program, you can use more like this: my_app -e somefile.txt | more . The problem with this, though, is that it stops and waits for you to hit a key once it fills up the buffer.
If you just want to dump the Console output to a file, you can say my_app.exe -e somefile.txt > consoleoutput.txt .
|
|
|
|
|
Has anyone seen the following error, using WSE 2.0 :
Microsoft.Web.Services2.Security.SecurityFault: An error was discovered processing the <security> header ---> System.ArguementOutOfRangeException: Ticks must be between DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks.
Then a call stack.
Attempting to use WSE 2.0 to login into my webservice using Kerberos Tokens. I only get this error when logging into the webservice if the webservice is on the local machine. If its on another machine, it seems to work ok.
Cheers,
"If you're too careful, your whole life can become a f---in' grind." - Mike McD (Rounders)
|
|
|
|
|
Hi,
Im beginner in direct3d programming.after I had installed directx 9.0 sdk,tried to write code using the methods of the IDirect3D9 interface. but IDE(Visual Studio 7)doesn't show list members by reference pointer to the interface .
please let me know how to ensure that.
Thanks
|
|
|
|
|
Hi, I had solved my problem.
Goto directoty \\Windows\Assembly\GAC then copy all file dll of Microsoft.DirectX into :\\Microsoft Visual Studio .NET 2003\Common7\IDE\PublicAssemblies
Thanks!
|
|
|
|
|
I have a windows installer (deployment project) as part of my VB.net solution. It is set up to remove previous versions prior to being installed. As part of the installation process, several configuration files are installed onto the machine along with the application.
I would like to set it up so that when the application is installed, it creates the configuration file if none exists, but leaves the file otherwise. I would also like to be able to flag in some instances that the file should overwrite regardless of whether the file exists or not.
Any pointers on how I can set this up in the deployment project, as I have not found a good source of information regarding it.
Thanks for the feedback,
sc
|
|
|
|
|
Sorry, there is no easy answer to this question. Forcing overwrites is easy - set the version of a file in a new install higher than previous versions, and it will always be installed.
Conditional install is much trickier and depends on Version, Date, and Language. Rules for non-versioned files are different.
The VS Installer provides a very limited interface. You will probably have to modify the msi database manually to accomplish what you need.
You can download the full Windows Installer documentation, along with tools that allow you to edit msi packages from MS:
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/default.htm?p=/msdownload/platformsdk/sdkupdate/SDKInfo.htm[^]
Editing msi table is not for the faint of heart. You can find a free e-book here:
http://www.larkware.com/InstallerBook.zip
You can also find forums and resources at:
http://www.installsite.org/[^]
Unless you really want to become an expert on Windows Installer technology, I suggest you farm it out to someone who already is.
|
|
|
|
|
Thanks for the feedback and info.
I was kind of afraid it was going to be as you describe it, but was hoping I had missed something simple. Apparently not. I'll look through the sites and try to guage what it will be like, but as this is a "nice to have but non-essential" item, I'll probably just give it a pass.
Thanks again.
|
|
|
|
|
Hi!
I've several client applications which call methods of singlecall objects on the same server. Now my question is wether the server processes requests which come at the same time parallel (implicit by multithreading) or serial?
Thanks in advance!
|
|
|
|
|
The remoting framework takes care of synchronization for you. You don't have to write any synchronization code. Each client will get it's own singlecall object.
Regards
Senthil
My Blog
|
|
|
|