473,654 Members | 3,239 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

.NET 2.0 memory usage: 32bit vs 64bit.

Hello,

I've compiled my app for AnyCPU setting in vs2005. Then I tried the app
on both 32-bit Windows 2003 R2 and 64-bit Windows 2003 R2. The memory
usage of the application when working on the same data set were
unbelievable (the data is from Task Manager) :

32-bit Windows 2003 R2
Mem Usage: 481,400k
Peak Mem: 583,020k

64-bit Windows 2003 R2
Mem Usage: 934,456k
Peak Mem: 1,254,008k

In other words, basically memory usage doubled. Now I can see that the
size of pointers would double, but most of the data is of type int,
short, string, etc... e.g. types that are the same size on 32 and 64 bit
machines (at least its c# aliases). The object model is pretty big and
it does have a lot of pointers to objects, but the size of the data
dwarfs the potential size of all the pointers, etc...

Why is difference so huge? Or am I measuring the wrong metrics here?

Regards
Mar 8 '07 #1
17 5697
Frank Rizzo wrote:
32-bit Windows 2003 R2
Mem Usage: 481,400k
Peak Mem: 583,020k

64-bit Windows 2003 R2
Mem Usage: 934,456k
Peak Mem: 1,254,008k
Why is difference so huge? Or am I measuring the wrong metrics here?
Have you tried, e.g. SOS or a memory profiler and finding out what
instances are alive and taking up all the space?

-- Barry

--
http://barrkel.blogspot.com/
Mar 8 '07 #2
Barry Kelly wrote:
Frank Rizzo wrote:
>32-bit Windows 2003 R2
Mem Usage: 481,400k
Peak Mem: 583,020k

64-bit Windows 2003 R2
Mem Usage: 934,456k
Peak Mem: 1,254,008k
>Why is difference so huge? Or am I measuring the wrong metrics here?

Have you tried, e.g. SOS or a memory profiler and finding out what
instances are alive and taking up all the space?
I have not. Know of any that would work on an x64 box?
>
-- Barry
Mar 8 '07 #3
"Frank Rizzo" <no**@none.comw rote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
Hello,

I've compiled my app for AnyCPU setting in vs2005. Then I tried the app on both 32-bit
Windows 2003 R2 and 64-bit Windows 2003 R2. The memory usage of the application when
working on the same data set were unbelievable (the data is from Task Manager) :

32-bit Windows 2003 R2
Mem Usage: 481,400k
Peak Mem: 583,020k

64-bit Windows 2003 R2
Mem Usage: 934,456k
Peak Mem: 1,254,008k

In other words, basically memory usage doubled. Now I can see that the size of pointers
would double, but most of the data is of type int, short, string, etc... e.g. types that
are the same size on 32 and 64 bit machines (at least its c# aliases). The object model is
pretty big and it does have a lot of pointers to objects, but the size of the data dwarfs
the potential size of all the pointers, etc...

Why is difference so huge? Or am I measuring the wrong metrics here?

Regards


What you are looking at is the Process WorkingSet size, not the memory taken by your managed
objects.
Better use the perfmon to watch the GC memory (CLR memory) and the process memory counters.
A memory increase of 30-50% isn't that unusual, but 100% is IMO not even impossible, are you
sure you are comparing the same application using the same Framework version?

Willy.

Mar 8 '07 #4
"Willy Denoyette [MVP]" <wi************ *@telenet.bewro te in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
"Frank Rizzo" <no**@none.comw rote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
>Hello,

I've compiled my app for AnyCPU setting in vs2005. Then I tried the app on both 32-bit
Windows 2003 R2 and 64-bit Windows 2003 R2. The memory usage of the application when
working on the same data set were unbelievable (the data is from Task Manager) :

32-bit Windows 2003 R2
Mem Usage: 481,400k
Peak Mem: 583,020k

64-bit Windows 2003 R2
Mem Usage: 934,456k
Peak Mem: 1,254,008k

In other words, basically memory usage doubled. Now I can see that the size of pointers
would double, but most of the data is of type int, short, string, etc... e.g. types that
are the same size on 32 and 64 bit machines (at least its c# aliases). The object model
is pretty big and it does have a lot of pointers to objects, but the size of the data
dwarfs the potential size of all the pointers, etc...

Why is difference so huge? Or am I measuring the wrong metrics here?

Regards

What you are looking at is the Process WorkingSet size, not the memory taken by your
managed objects.
Better use the perfmon to watch the GC memory (CLR memory) and the process memory
counters.
A memory increase of 30-50% isn't that unusual, but 100% is IMO not even impossible, are
you sure you are comparing the same application using the same Framework version?

Willy.


Sorry, this: ... but 100% is IMO not even impossible, ...
should read:
but 100% is IMO even impossible, ...

Note, that there is quite a difference between the JIT32 and the JIT64, and the GC behavior
and generational thresholds are also quite different too. My guess is this application is
using the Server GC on a multi-proc machine, that means that you have several GC heaps . The
space taken by the application code (native run-time libraries, JITted code, CLR stuff
etc..) account for a space increase of ~30%, the size increase of the objects in the GC
heap, depend highly on the number of objects and the number of references (pointer size!)
used as members.

Willy.

Mar 8 '07 #5
Sorry, this: ... but 100% is IMO not even impossible, ...
should read:
but 100% is IMO even impossible, ...

Note, that there is quite a difference between the JIT32 and the JIT64,
and the GC behavior and generational thresholds are also quite different
too. My guess is this application is using the Server GC on a multi-proc
machine, that means that you have several GC heaps . The space taken by
the application code (native run-time libraries, JITted code, CLR stuff
etc..) account for a space increase of ~30%, the size increase of the
objects in the GC heap, depend highly on the number of objects and the
number of references (pointer size!) used as members.
ok, I'll repeat the test with the perfmon counters you suggested and
will report back.
Mar 8 '07 #6
Frank Rizzo wrote:
Have you tried, e.g. SOS or a memory profiler and finding out what
instances are alive and taking up all the space?

I have not. Know of any that would work on an x64 box?
WinDbg & SOS should work. E.g. see:

http://blogs.msdn.com/ricom/archive/...10/279612.aspx

There should be an SOS.dll for the 64-bit framework. WinDbg has versions
for Itanium, x64 etc. Google for WinDbg and you'll find it.

-- Barry

--
http://barrkel.blogspot.com/
Mar 9 '07 #7
>What you are looking at is the Process WorkingSet size, not the memory
>taken by your managed objects.
Better use the perfmon to watch the GC memory (CLR memory) and the
process memory counters.
A memory increase of 30-50% isn't that unusual, but 100% is IMO not
even impossible, are you sure you are comparing the same application
using the same Framework version?
Willy, specifically, which counters should I be looking at?

Regards
Mar 9 '07 #8
"Frank Rizzo" <no**@none.comw rote in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
>>What you are looking at is the Process WorkingSet size, not the memory taken by your
managed objects.
Better use the perfmon to watch the GC memory (CLR memory) and the process memory
counters.
A memory increase of 30-50% isn't that unusual, but 100% is IMO not even impossible, are
you sure you are comparing the same application using the same Framework version?

Willy, specifically, which counters should I be looking at?

Regards

Start with:
CLR memory counters - #Bytes in all heaps and the Large Object Heap.
and
Process memory counters - Private Byes and Working Set.

Willy.
Mar 9 '07 #9
Willy wrote:
>Sorry, this: ... but 100% is IMO not even impossible, ...
should read:
but 100% is IMO even impossible, ...

Note, that there is quite a difference between the JIT32 and the
JIT64, and the GC behavior and generational thresholds are also quite
different too. My guess is this application is using the Server GC on
a multi-proc machine, that means that you have several GC heaps . The
space taken by the application code (native run-time libraries, JITted
code, CLR stuff etc..) account for a space increase of ~30%, the size
increase of the objects in the GC heap, depend highly on the number of
objects and the number of references (pointer size!) used as members.

ok, I'll repeat the test with the perfmon counters you suggested and
will report back.
Ok, I tested with perfmon as you suggested and the results aren't
better. The counters were all setup per application and all the numbers
are averages (btw, the number barely deviated from the average anyway)

64-bit:
..NET CLR Memory/#Bytes in all Heaps - 1,420,730,503
Process/Private Bytes - 1,524,000,000
..NET CLR LocksAndThreads/# of current logical threads - 9
32-bit:
..NET CLR Memory/#Bytes in all Heaps - 830,413,699
Process/Private Bytes - 781,433,124
..NET CLR LocksAndThreads/# of current logical threads - 9

The last counter is there to make sure that the thread stacks aren't
leaking.

So, as you can see, on the 64-bit end of things, the memory usage is
basically doubled. Is this right? I'll try and use WinDbg next (once I
learn it) and see what else can be uncovered. The numbers basically
didn't change over a long period of time, suggesting that there are no
memory leaks.

Regards
Mar 9 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2587
by: Ian | last post by:
Hi all, I have a problem. I have an application which needs to work with a lot of data, but not all at the same time. It is arranged as a set of objects, each with lots of data that is created when the object is instantiated. I'd ideally like to keep as many objects as possible in memory, but I can get rid of any object the program isn't currently using. Is there any way I can access the amount of memory python is using? I can
8
3665
by: rbt | last post by:
Would a Python process consume more memory on a PC with lots of memory? For example, say I have the same Python script running on two WinXP computers that both have Python 2.4.0. One computer has 256 MB of Ram while the other has 2 GB of Ram. On the machine with less Ram, the process takes about 1 MB of Ram. On the machine with more Ram, it uses 9 MB of Ram. Is this normal and expected behavior?
2
460
by: tomvr | last post by:
Hello I have noticed some 'weird' memory usage in a vb.net windows app The situation is as follows I have an app (heavy on images) with 2 forms (actually there are more forms and on starting the app I load some things into memory for global use of the app but I'll use only 2 starting forms to explain the situation) situation 1 start app with form 1 (72mb memory usage), show form 2 and hide form 1 (89 mb memory usage
2
422
by: Jarvis | last post by:
I've made a testing program to test the memory usage of some Data Forms. I create a MDI parent form with one single MDI child form, which is a Data Form generated by .NET Data Form Wizard. To test the stuff, I keep to open that child data form for about 10 times. the memory usage shown in GC and task manager both increase. Then I close all those forms. and perform GC collect. The memory usage shown in GC falls, however, the memory...
3
4135
by: Ian Taite | last post by:
Hello, I'm exploring why one of my C# .NET apps has "high" memory usage, and whether I can reduce the memory usage. I have an app that wakes up and processes text files into a database periodically. What happens, is that the app reads the contents of a text file line by line into an ArrayList. Each element of the ArrayList is a string representing a record from the file. The ArrayList is then processed, and the arraylist goes out of...
7
5184
by: George Gre | last post by:
Hi, I wrote a c# programme that listens to incoming TCP requests and services them. This programme is meant to be running as long as the server its installed on is running. So we assume for ever(!). My problem is that I have it running for 2 days now on my pc (win2Ksp3 P4 2GHz,512MB Ram - framework v1.0.3705) and the taskmanager reports that this process takes 97MB ram/130 VMemory and it looks that its eating up more ram(!!). To help...
20
4214
by: Philip Carnstam | last post by:
How come .Net applications use so much memory? Every application I compile uses at least 10 MB of memory, even the ones consisting of only a form and nothing else. If I minimize them though the memory usage drops to a couple hundred KB. Why? Is there anything I should to to prevent this? I have compiled in release and deactivated all forms of debugging, I think! Thanks, Philip
2
2459
by: jld | last post by:
Hi, I developed an asp.net based eCommerce Website for a client and it is hosted at discount asp. The site is quite interactive, queries a database a lot and uses ajax.asp.net to spice up interactivity. The service suffers from a lot of restarts since discountasp enforces a 100mb per worker thread limit and when you top it, the service gets restarted. When there is a lot of traffic on the site, this happens
9
4173
by: deerchao | last post by:
I'm developing a WinForms application. It slowly eats up memory, one client reported that it took 200MB or more, and finnaly crashed. I myself noticed it's common to use up 30MB memory, but if I minimize it (all the Forms will Hide, only a NotifyIcon is shown at the System Notification Area), the memory usage comes down to 8MB immediately. After that, even if I show the Forms again, it uses only 8MB memory. Do I have another way to...
0
8379
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8294
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,...
0
8709
jinu1996
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...
0
8596
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7309
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5627
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();...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1924
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1597
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.