Tech Off Thread

5 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

6MB ping app?

Back to Forum: Tech Off
  • User profile image
    Shiv

    this was a test app in .net 2.0 and i was surperised to notice that this takes 6MB RAM but after sometime it reduces to 1.3 MB
    here's the code

    using System;
    using System.Net.NetworkInformation;

    class pinger
    {
    public static void Main()
    {
    Ping myping = new Ping();
    Console.WriteLine(" Enter IP ");
    string ip = Console.ReadLine();
    if (ip == "")
    {
    Console.WriteLine("Using XXX.XXX.XXX.XXX");
    ip =
    "XXX.XXX.XXX.XXX";//any default ip
    }
    PingReply reply = myping.Send(ip, 3000);//ip, timeout value
    while (reply.Status!=IPStatus.Success)
    {
    if (reply.Status==IPStatus.TimedOut)
    {
    Console.WriteLine("Timeout");
    reply = myping.Send(ip, 3000);
    }
    }
    Console.WriteLine("Connected");
    Console.Beep();
    Console.ReadLine();
    }
    }

    can anyone tell me how it got 6MB any why(may be due to GC) it later reduced to 1.3MB

  • User profile image
    Sven Groot

    This explains it better than I could: How much memory does my .NET application use?

  • User profile image
    Shiv

    good article, thanks for the referance. but i still don't get one thing ,the task manager either overestimates or underestimates the mem usage . thats what is said in the article, can we do any analysis like performance explorer in vs2005

  • User profile image
    Manip

    Run it though NGen

  • User profile image
    Tom Servo

    In addition to the article linked above, .NET reserves memory ahead in 2MB chunks to anticipate allocation spikes.

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.