Archived

This forum has been archived. Please start a new discussion on GitHub.

Is it all right for a ICE hello demo with such size of memory usage?

hi,
I run the helloS demo and found that the memory usages seem surprisely high.
C++ : about 7 M
c# : about 13M
java : about 13M

OS: windows 2000
IDE: vs2003
version: debug

I did not try the release version so can not say more about it. I want to know if the results are ok as anticipated. Any more explainations are appreciated.

Thanks in advanc.
OrNot

Comments

  • benoit
    benoit Rennes, France
    Hi,

    It would be interesting to see the numbers without the memory footprint of Ice to be able to compare. It's quite possible that Ice consumes few MB as it creates some threads and if I'm not mistaken the default thread stack size is 1MB on Windows.

    Benoit.
  • So sorry for this question. I just found that it has been asked hundreds of years ago.
    http://www.zeroc.com/vbulletin/showthread.php?t=1232


    Anyway, the size seems a bit too big.
  • benoit
    benoit Rennes, France
    You should try with an optimized version to test this. And again without anything to compare to, it's difficult to say if it's high or not. In any case, as Marc mentioned in the other thread, there's probably not much we can do to reduce the memory footprint.

    If you're really concerned about size, I recommend you to look into Ice-E, the embedded version of Ice.

    Benoit.
  • How exactly do you measure the size? Is this physical memory or virtual memory? Keep in mind that each new thread adds a lot of virtual memory (for the per-thread stack), but only very little physical memory.

    Also note that the hello demo loads the IceSSL DLL, which adds to the overall size. You might want to disable SSL in the demo before you measure the size.

    For Java, most of the memory is used by the Java virtual machine itself (ditto for C#). That's why IceBox for Java is so useful: it allows you to run several Ice applications in a single Java virtual machine.
  • Thank you Benoit.
    I had thought ICE-E was designed mainly for portability. Do you mean it can replace the ICE ? Is there any tradeoff between them or the ICE-E win an overall advantage over ICE?
    BTW: Is it easy to transfer the codes based on ICE to ICE-E?
  • Ice-E has a more limited feature set than Ice. Please check out the README in the Ice-E distribution for details.

    As long as you don't use any of the features which Ice-E does not have, it's easy to port code from Ice to Ice-E. In most cases, you won't have to do anything, except for changing an include file name.

    For regular applications, I do not recommend to use Ice-E, but the full version of Ice. Ice-E is intended for mobile and embedded devices, such as cell phones or PDAs.
  • hi, Marc,
    I disabled the ssl but seemed not to help much.
    You are right in that I did have not a strict standard to say HelloS is of big size. But I feel surprise because I had thought it should be very small
    since it only implemented such a simple interface. It is often listed in my top
    ten processes at the column of the memory useage in the task maganger.
    Actually this doesn't much matter in my project. I just feel curious. Of course,
    if the size of a ICE-Application will not be notablely noticed by my clients ,I will be more happy. ;)
    Thank you .
  • I just tested an optimized version of the "helloS" server.exe, and I got about 4MB (see attachment), which seems reasonable for the full version of Ice (at least compared to all the other stuff running on my system). This is on Windows XP with Visual C++ 6.0. You might get smaller sizes if you optimize for size instead for speed.
  • OrNot wrote:
    You are right in that I did have not a strict standard to say HelloS is of big size. But I feel surprise because I had thought it should be very small since it only implemented such a simple interface.

    Keep in mind that task manager reports the pages that are currently mapped in memory. (Often, that is the worst-case memory usage that a process has had at some time in the past.) So, the memory usage reported by task manager includes all the pages that were faulted in during process startup, including pages that run once-only initialization code. Typically, these pages stay in memory because the OS will not swap them out unless it finds itself starved of memory, so the number reported by task manager usually has little to do with the actual memory consumption.

    What matters is not the overall process size, but the working set size (that is, the pages that are actually being used while the process is in steady state). The working set size is normally much smaller than the process size.

    A simple trick to find the working set size of your server is to run the server in a window, and run a client that exercises the server in another window. Then minimize the window the server runs in. Windows trims the working set of a process when you minimize its window, so you will see the memory size reported by task manager fall at that point. Continue to exercise the server (while minimized) from the client. What is now reported by task manager is much closer to the real working set size of the process.

    With a release build and a simple client and server, I get 570kB for the server.

    Cheers,

    Michi.
  • hi,Michi,
    Thanks for your thorough elucidation.
    I am so pleasantly surprised to know that demo is reduced to 570K. At least , my clients ,especially my boss,will not complain anything about my project. As you know, they never try to understand some concepts such as
    page swapping, virtual memory and so on. Their most powerful tool to evaluate an application is the ctrl+alt+del hotkeys and then check those numbers. Now, 570K is enough for me to defeat their task manager . ;)
    Michi, could you please tell me your compiler configurations in details?
    Thanks in advance.

    OrNot
  • Here is a screenshot of the taskmanager with the "helloS" server.exe running in a minimized window. Small enough? :)
  • OrNot wrote:
    Michi, could you please tell me your compiler configurations in details?

    Nothing special. I used VC++ 6, release build. I just used a simple client and server with an operation that does nothing (so the measurement wouldn't pick up additional stuff, such as writing to the console). You should get similar figures for your own code.

    Cheers,

    Michi.
  • Memory usage question reload.....

    Hi, Michi,
    I have a question about the memory usage.

    Now we are working on an image processing project. The algorithm eats huge size of memory. In same machine, there may be several processes running simultaneously.

    Our platform is winxp 32 os. From microsoft, it is said the max physical memory a machine can be installed is about 4G. It is no doubt every process occupies 4G address space and user memory is less than 2G. This is a basic knowledge point and I know it.

    Suppose I have enough money and my pc has enough memory slots
    and I install 16G physical memory now and I am running 4 memory-intensive
    application as mentioned before, I had thought the extra physical memory more than 4G can reduce the frequency of swapping. That is, the more processes can reside in the physical memory simultaneously. Ideally Process A in first 4G physical memory and Process B in second 4G physical memory and so on so forth. I thought OS must have the capability to locate and map these physical memory to logic memory space. Here let's assume the memory of every process is in use all the time. That's they can not be swapped out for another process.

    But I must mis-understand something here.

    Any help is appreciated.

    Thanks
    OrNot
  • benoit
    benoit Rennes, France
    Hi,

    I would recommend to check the Windows forums instead as this is more related to Windows. But yes, Windows XP can take advantage of the 16GB of memory with PAE enabled, see this link.

    Cheers,
    Benoit.
  • Thanks Benoit. I would have gone to msdn but sometimes I trust you guys more than msdn. :)