Developers: Question about .Net Windows Services

by Elsewhere 16 Replies latest jw friends

  • Elsewhere
    Elsewhere

    Last night I decided to start messing around with a Windows Service. It is very simple, all it does is monitor my computer?s IP address and if it changes the new IP address is FTPed to my web server in a small XML document.

    I thought this could be very useful considering my Cable Modem changes its IP address every now and then and I like to Remote Desktop into my home PC quite frequently.

    Now the problem... like I said, the program is very small and simple and the actual exe is 28 KB and has an accompanying dll that is 52 KB. Very reasonable. BUT... when the service is running and I check the system processes, this thing is reporting that it is occupying 14,500 KB !

    Is this just a side effect of using .Net to write a Windows Service or am I doing something wrong?

  • AlmostAtheist
    AlmostAtheist

    I don't have much experience with the .NET framework, so this is more general than specific.

    Is it growing? Or staying at 15meg?

    If you strip out all your code and just keep the stuff that you reference via .NET, is it still that big?

    Do you have any classes that automatically allocate a huge array in their constructor? Maybe you don't need the object in question, or maybe you can use it by reference without actually creating an instance?

    Or maybe some apostates have hacked your system! I've heard they've even gotten into the U.N. web site...

    Dave

  • seattleniceguy
    seattleniceguy

    A couple things to keep in mind:

    • Garbage collection algorithms are based partly on demaind for memory. If you have a lot of memory and no competing programs running, the gc is sometimes very lax about working.
    • Even though your exe is only 28K, keep in mind that the .NET plumbing that it consumes requires memory resources.

    I wrote a Windows service on my last assignment at work, but I don't remember checking to see how much memory it was consuming. However, most small Windows apps I've written tend to hang out around 15 or 16MB at the low end, so it doesn't really sound out of bounds to me.

    SNG

  • seattleniceguy
    seattleniceguy
    Or maybe some apostates have hacked your system! I've heard they've even gotten into the U.N. web site...

    LOL! Those crazy apostates! Actually, Elsewhere, I confess, I needed a little extra memory for an online game I was playing so I created this program that "borrows" 10 MB from everyone on JWD. Sure, accessing memory through the Internet is slower that just using virtual memory, but hey, it's more fun when it's illegal. So yeah, your actual program is only using 6MB. Sorry about any inconvenience.

    SNG

  • drwtsn32
    drwtsn32

    Else, have you looked at using one of the free DDNS providers (like dyndns.org)? There are many software apps written for DDNS purposes that monitor your IP and update DNS when necessary.

    Just a thought. :)

  • Elsewhere
    Elsewhere
    I needed a little extra memory for an online game I was playing so I created this program that "borrows" 10 MB from everyone on JWD

    lol.... damnit! I want my memory back!

    Doc,

    This doesn't have to do with my domain name. My domain is hosted by a company I pay, so my domain IP address never changes. What I am doing is storing my home computer's IP address on my domain web site so that I can always know my home IP address and therefore access my home computer from a remote location.

    I remote desktop into my pc all the time from different locations.

  • stevenyc
    stevenyc

    Elsewhere,

    What are you writing your app in?

    steve

  • catchthis
    catchthis

    Else, what Doc said about dyndns.org isn't for your hosted domain name. As its name infers, a dynamic dns resolution service does exactly what you are trying to do. Quite simply, if you go to dyndns.org and sign up for their free service, you are allowed up to five subdomains. They have a list of 20-30 domains to pick from. You could use a domain name such as "elsewhere.homedns.org" or something like that. And then download one of the several dynamic ip resolution programs that are available. I use a free one called DynDNS Updater by Kana. It sends out a HTTP GET message to dyndns.org to check your public ip address and then modifies it with dyndns.org if it changes. Very easy to use.

  • Simon
    Simon

    It's likely the .NET runtime that is taking up the memory.

    As people have said though, dynamic dns is the better solution IMO.

    You can also us things like www.gotomypc.com for the same thing.

  • Elsewhere
    Elsewhere

    I'm aware of DynDNS and I have used that in the past. The problem is that I have my own DNS servers for my domain and I don't wan't to buy another domain just for my home computer.

    To use DynDNS you need to use their DNS servers, something I don't want to do. Gotomypc.com is a pay service and I don't want to mess with that.

    I think everyone is confusing my home PC with my web site. They have nothing to do with each other. I just like to store my home pc's IP address on my web site so that I can go there and then click on a link to go to my home pc.

Share this

Google+
Pinterest
Reddit