My system has 4GB memory and My program in C# is really memory
consuming. and I noticed that when the memory I used is more than 2GB I
will get an exception.
How to solve this? thanks a lot 13 5456
That is a windows issue not a C# issue ..There is a 2gb process limit in
windows ..
see http://msdn.microsoft.com/library/de...netchapt17.asp
search for /3 gb for instructions for how to make this larger.
Cheers,
Greg Young
MVP - C# http://codebetter.com/blogs/gregyoung
"fAnSKyer/C# newbie" <fa******@gmail .comwrote in message
news:11******** **************@ m7g2000cwm.goog legroups.com...
My system has 4GB memory and My program in C# is really memory
consuming. and I noticed that when the memory I used is more than 2GB I
will get an exception.
How to solve this? thanks a lot
"fAnSKyer/C# newbie" <fa******@gmail .comwrote in message
news:11******** **************@ m7g2000cwm.goog legroups.com...
| My system has 4GB memory and My program in C# is really memory
| consuming. and I noticed that when the memory I used is more than 2GB I
| will get an exception.
|
| How to solve this? thanks a lot
|
Why does your program uses that much memory? Is it by design or are you
chasing a bug?
If it's the first, you'll have to change your design or move to a 64 bit OS,
if it's a bug, you will have to profile your application.
Willy.
I'm pretty sure .Net doesn't respects the /3gb switch.
I haven't looked in a while, but I know we did quite a bit of performance
tuning in 32-bit land a while back and were very crabby about this.
Fortunatly 64-bit hardware came along, and life was good. I love allocating
20+gb of memory! :)
--
Chris Mullins, MCSD.NET, MCPD:Enterprise http://www.coversant.net/blogs/cmullins
"Greg Young" <dr************ *******@hotmail .comwrote in message
news:eV******** ******@TK2MSFTN GP05.phx.gbl...
That is a windows issue not a C# issue ..There is a 2gb process limit in
windows ..
see http://msdn.microsoft.com/library/de...netchapt17.asp
search for /3 gb for instructions for how to make this larger.
Cheers,
Greg Young
MVP - C# http://codebetter.com/blogs/gregyoung
"fAnSKyer/C# newbie" <fa******@gmail .comwrote in message
news:11******** **************@ m7g2000cwm.goog legroups.com...
>My system has 4GB memory and My program in C# is really memory consuming. and I noticed that when the memory I used is more than 2GB I will get an exception.
How to solve this? thanks a lot
You're not hitting .Net limits, you're hitting 32-bit Windows Process
limits. In 32-bit land, you're pretty much stuck.
You're going to need to go buy 64-bit hardware, install a 64-bit O/S (XP,
Win2k3, Vista, Longhorn), and run your application as a 64-bit app.
--
Chris Mullins, MCSD.NET, MCPD:Enterprise http://www.coversant.net/blogs/cmullins
"fAnSKyer/C# newbie" <fa******@gmail .comwrote in message
news:11******** **************@ m7g2000cwm.goog legroups.com...
My system has 4GB memory and My program in C# is really memory
consuming. and I noticed that when the memory I used is more than 2GB I
will get an exception.
How to solve this? thanks a lot
Sure it does, .NET (the CLR) is LARGEADRESSAWAR E since v1.1. The only
problem is that the C# compiler doesn't have an option to set the
largeaddressawa re flag, you have to edit the PE header using editbin.
editbin /largeaddressawa re <some.exe>
Another option (framework V2)is to compile all modules as netmodules using
the /t:module compiler flag and use the linker (link.exe) to build the PE
file.
here is a sample of such linker command...
link /entry:someNames pace.someClass. Main /subsystem:conso le
/largeaddressawa re some.netmodule someother.netmo dule
in both cases you should see something like following when running dumpbin
File Type: EXECUTABLE IMAGE
FILE HEADER VALUES
14C machine (x86)
3 number of sections
452C1EAA time date stamp Wed Oct 11 00:28:58 2006
0 file pointer to symbol table
0 number of symbols
E0 size of optional header
122 characteristics
Executable
Application can handle large (>2GB) addresses
32 bit word machine
Willy.
"Chris Mullins" <cm******@yahoo .comwrote in message
news:uv******** ******@TK2MSFTN GP02.phx.gbl...
| I'm pretty sure .Net doesn't respects the /3gb switch.
|
| I haven't looked in a while, but I know we did quite a bit of performance
| tuning in 32-bit land a while back and were very crabby about this.
|
| Fortunatly 64-bit hardware came along, and life was good. I love
allocating
| 20+gb of memory! :)
|
| --
| Chris Mullins, MCSD.NET, MCPD:Enterprise
| http://www.coversant.net/blogs/cmullins
|
|
|
| "Greg Young" <dr************ *******@hotmail .comwrote in message
| news:eV******** ******@TK2MSFTN GP05.phx.gbl...
| That is a windows issue not a C# issue ..There is a 2gb process limit in
| windows ..
| >
| see
| > http://msdn.microsoft.com/library/de...netchapt17.asp
| search for /3 gb for instructions for how to make this larger.
| >
| Cheers,
| >
| Greg Young
| MVP - C#
| http://codebetter.com/blogs/gregyoung
| >
| "fAnSKyer/C# newbie" <fa******@gmail .comwrote in message
| news:11******** **************@ m7g2000cwm.goog legroups.com...
| >My system has 4GB memory and My program in C# is really memory
| >consuming. and I noticed that when the memory I used is more than 2GB I
| >will get an exception.
| >>
| >How to solve this? thanks a lot
| >>
| >
| >
|
|
Sure enough. A quick Google Search agrees with you.
I wonder if the last time I tried was v1.0? I don't think it's been that
long.
I do remember at that time (we were doing extensive profiling), we wanted to
host our Server using the Server CLR, not the Workstation CLR. I needed to
write a C++ hosting exe to do this. If I remember right, that means it must
have been 1.0, since in 1.1 CLR selection was a config file entry.
Ah well. I'm probably just confused. We've been 64-bit for a while now, so
this just doesn't come up for me anymore. Anytime a customer asks "how big
can it scale?" we just give out the 64-bit numbers.
--
Chris Mullins, MCSD.NET, MCPD:Enterprise http://www.coversant.net/blogs/cmullins
"Willy Denoyette [MVP]" <wi************ *@telenet.bewro te in message
news:eP******** ******@TK2MSFTN GP03.phx.gbl...
Sure it does, .NET (the CLR) is LARGEADRESSAWAR E since v1.1. The only
problem is that the C# compiler doesn't have an option to set the
largeaddressawa re flag, you have to edit the PE header using editbin.
editbin /largeaddressawa re <some.exe>
Another option (framework V2)is to compile all modules as netmodules using
the /t:module compiler flag and use the linker (link.exe) to build the PE
file.
here is a sample of such linker command...
link /entry:someNames pace.someClass. Main /subsystem:conso le
/largeaddressawa re some.netmodule someother.netmo dule
in both cases you should see something like following when running dumpbin
File Type: EXECUTABLE IMAGE
FILE HEADER VALUES
14C machine (x86)
3 number of sections
452C1EAA time date stamp Wed Oct 11 00:28:58 2006
0 file pointer to symbol table
0 number of symbols
E0 size of optional header
122 characteristics
Executable
Application can handle large (>2GB) addresses
32 bit word machine
Willy.
"Chris Mullins" <cm******@yahoo .comwrote in message
news:uv******** ******@TK2MSFTN GP02.phx.gbl...
| I'm pretty sure .Net doesn't respects the /3gb switch.
|
| I haven't looked in a while, but I know we did quite a bit of
performance
| tuning in 32-bit land a while back and were very crabby about this.
|
| Fortunatly 64-bit hardware came along, and life was good. I love
allocating
| 20+gb of memory! :)
|
| --
| Chris Mullins, MCSD.NET, MCPD:Enterprise
| http://www.coversant.net/blogs/cmullins
|
|
|
| "Greg Young" <dr************ *******@hotmail .comwrote in message
| news:eV******** ******@TK2MSFTN GP05.phx.gbl...
| That is a windows issue not a C# issue ..There is a 2gb process limit
in
| windows ..
| >
| see
| > http://msdn.microsoft.com/library/de...netchapt17.asp
| search for /3 gb for instructions for how to make this larger.
| >
| Cheers,
| >
| Greg Young
| MVP - C#
| http://codebetter.com/blogs/gregyoung
| >
| "fAnSKyer/C# newbie" <fa******@gmail .comwrote in message
| news:11******** **************@ m7g2000cwm.goog legroups.com...
| >My system has 4GB memory and My program in C# is really memory
| >consuming. and I noticed that when the memory I used is more than 2GB
I
| >will get an exception.
| >>
| >How to solve this? thanks a lot
| >>
| >
| >
|
|
Thanks a lot for give me great help.
I will try the /3GB to see if it solve the problem
But I am quite curious that a 32-bit can search a 4GB memory, why the
bottleneck is 2GB?
This is not a bug, but I am wonder if I can do it better because I
write 2 memory consuming thread in one program. I may separate them to
two program and using .NET remoting to control these two to solve this?
Thanks again
fAnSKyer
Chris Mullins wrote:
Sure enough. A quick Google Search agrees with you.
I wonder if the last time I tried was v1.0? I don't think it's been that
long.
I do remember at that time (we were doing extensive profiling), we wanted to
host our Server using the Server CLR, not the Workstation CLR. I needed to
write a C++ hosting exe to do this. If I remember right, that means it must
have been 1.0, since in 1.1 CLR selection was a config file entry.
Ah well. I'm probably just confused. We've been 64-bit for a while now, so
this just doesn't come up for me anymore. Anytime a customer asks "how big
can it scale?" we just give out the 64-bit numbers.
--
Chris Mullins, MCSD.NET, MCPD:Enterprise http://www.coversant.net/blogs/cmullins
"Willy Denoyette [MVP]" <wi************ *@telenet.bewro te in message
news:eP******** ******@TK2MSFTN GP03.phx.gbl...
Sure it does, .NET (the CLR) is LARGEADRESSAWAR E since v1.1. The only
problem is that the C# compiler doesn't have an option to set the
largeaddressawa re flag, you have to edit the PE header using editbin.
editbin /largeaddressawa re <some.exe>
Another option (framework V2)is to compile all modules as netmodules using
the /t:module compiler flag and use the linker (link.exe) to build the PE
file.
here is a sample of such linker command...
link /entry:someNames pace.someClass. Main /subsystem:conso le
/largeaddressawa re some.netmodule someother.netmo dule
in both cases you should see something like following when running dumpbin
File Type: EXECUTABLE IMAGE
FILE HEADER VALUES
14C machine (x86)
3 number of sections
452C1EAA time date stamp Wed Oct 11 00:28:58 2006
0 file pointer to symbol table
0 number of symbols
E0 size of optional header
122 characteristics
Executable
Application can handle large (>2GB) addresses
32 bit word machine
Willy.
"Chris Mullins" <cm******@yahoo .comwrote in message
news:uv******** ******@TK2MSFTN GP02.phx.gbl...
| I'm pretty sure .Net doesn't respects the /3gb switch.
|
| I haven't looked in a while, but I know we did quite a bit of
performance
| tuning in 32-bit land a while back and were very crabby about this.
|
| Fortunatly 64-bit hardware came along, and life was good. I love
allocating
| 20+gb of memory! :)
|
| --
| Chris Mullins, MCSD.NET, MCPD:Enterprise
| http://www.coversant.net/blogs/cmullins
|
|
|
| "Greg Young" <dr************ *******@hotmail .comwrote in message
| news:eV******** ******@TK2MSFTN GP05.phx.gbl...
| That is a windows issue not a C# issue ..There is a 2gb process limit
in
| windows ..
| >
| see
| > http://msdn.microsoft.com/library/de...netchapt17.asp
| search for /3 gb for instructions for how to make this larger.
| >
| Cheers,
| >
| Greg Young
| MVP - C#
| http://codebetter.com/blogs/gregyoung
| >
| "fAnSKyer/C# newbie" <fa******@gmail .comwrote in message
| news:11******** **************@ m7g2000cwm.goog legroups.com...
| >My system has 4GB memory and My program in C# is really memory
| >consuming. and I noticed that when the memory I used is more than 2GB
I
| >will get an exception.
| >>
| >How to solve this? thanks a lot
| >>
| >
| >
|
|
That's just the way Win32 works. This is why the move to 64 bit computing
has been so welcomed by database providers and other server application
authors.
For more detail: http://msdn.microsoft.com/msdnmag/issues/0700/hood/ http://msdn.microsoft.com/library/de...sdn_virtmm.asp
--
Chris Mullins, MCSD.NET, MCPD:Enterprise http://www.coversant.net/blogs/cmullins
"fAnSKyer/C# newbie" <fa******@gmail .comwrote in message
news:11******** *************@i 42g2000cwa.goog legroups.com...
Thanks a lot for give me great help.
I will try the /3GB to see if it solve the problem
But I am quite curious that a 32-bit can search a 4GB memory, why the
bottleneck is 2GB?
This is not a bug, but I am wonder if I can do it better because I
write 2 memory consuming thread in one program. I may separate them to
two program and using .NET remoting to control these two to solve this?
Thanks again
fAnSKyer
Chris Mullins wrote:
>Sure enough. A quick Google Search agrees with you.
I wonder if the last time I tried was v1.0? I don't think it's been that long.
I do remember at that time (we were doing extensive profiling), we wanted to host our Server using the Server CLR, not the Workstation CLR. I needed to write a C++ hosting exe to do this. If I remember right, that means it must have been 1.0, since in 1.1 CLR selection was a config file entry.
Ah well. I'm probably just confused. We've been 64-bit for a while now, so this just doesn't come up for me anymore. Anytime a customer asks "how big can it scale?" we just give out the 64-bit numbers.
-- Chris Mullins, MCSD.NET, MCPD:Enterprise http://www.coversant.net/blogs/cmullins
"Willy Denoyette [MVP]" <wi************ *@telenet.bewro te in message news:eP******* *******@TK2MSFT NGP03.phx.gbl.. .
Sure it does, .NET (the CLR) is LARGEADRESSAWAR E since v1.1. The only
problem is that the C# compiler doesn't have an option to set the
largeaddressawa re flag, you have to edit the PE header using editbin.
editbin /largeaddressawa re <some.exe>
Another option (framework V2)is to compile all modules as netmodules
using
the /t:module compiler flag and use the linker (link.exe) to build the
PE
file.
here is a sample of such linker command...
link /entry:someNames pace.someClass. Main /subsystem:conso le
/largeaddressawa re some.netmodule someother.netmo dule
in both cases you should see something like following when running
dumpbin
File Type: EXECUTABLE IMAGE
FILE HEADER VALUES
14C machine (x86)
3 number of sections
452C1EAA time date stamp Wed Oct 11 00:28:58 2006
0 file pointer to symbol table
0 number of symbols
E0 size of optional header
122 characteristics
Executable
Application can handle large (>2GB) addresses
32 bit word machine
Willy.
"Chris Mullins" <cm******@yahoo .comwrote in message
news:uv******** ******@TK2MSFTN GP02.phx.gbl...
| I'm pretty sure .Net doesn't respects the /3gb switch.
|
| I haven't looked in a while, but I know we did quite a bit of
performance
| tuning in 32-bit land a while back and were very crabby about this.
|
| Fortunatly 64-bit hardware came along, and life was good. I love
allocating
| 20+gb of memory! :)
|
| --
| Chris Mullins, MCSD.NET, MCPD:Enterprise
| http://www.coversant.net/blogs/cmullins
|
|
|
| "Greg Young" <dr************ *******@hotmail .comwrote in message
| news:eV******** ******@TK2MSFTN GP05.phx.gbl...
| That is a windows issue not a C# issue ..There is a 2gb process
limit
in
| windows ..
| >
| see
| > http://msdn.microsoft.com/library/de...netchapt17.asp
| search for /3 gb for instructions for how to make this larger.
| >
| Cheers,
| >
| Greg Young
| MVP - C#
| http://codebetter.com/blogs/gregyoung
| >
| "fAnSKyer/C# newbie" <fa******@gmail .comwrote in message
| news:11******** **************@ m7g2000cwm.goog legroups.com...
| >My system has 4GB memory and My program in C# is really memory
| >consuming. and I noticed that when the memory I used is more than
2GB
I
| >will get an exception.
| >>
| >How to solve this? thanks a lot
| >>
| >
| >
|
|
This is a prime example of why multiple process is preferred in many cases
over multi-thread :)
Cheers,
Greg
"fAnSKyer/C# newbie" <fa******@gmail .comwrote in message
news:11******** *************@i 42g2000cwa.goog legroups.com...
Thanks a lot for give me great help.
I will try the /3GB to see if it solve the problem
But I am quite curious that a 32-bit can search a 4GB memory, why the
bottleneck is 2GB?
This is not a bug, but I am wonder if I can do it better because I
write 2 memory consuming thread in one program. I may separate them to
two program and using .NET remoting to control these two to solve this?
Thanks again
fAnSKyer
Chris Mullins wrote:
>Sure enough. A quick Google Search agrees with you.
I wonder if the last time I tried was v1.0? I don't think it's been that long.
I do remember at that time (we were doing extensive profiling), we wanted to host our Server using the Server CLR, not the Workstation CLR. I needed to write a C++ hosting exe to do this. If I remember right, that means it must have been 1.0, since in 1.1 CLR selection was a config file entry.
Ah well. I'm probably just confused. We've been 64-bit for a while now, so this just doesn't come up for me anymore. Anytime a customer asks "how big can it scale?" we just give out the 64-bit numbers.
-- Chris Mullins, MCSD.NET, MCPD:Enterprise http://www.coversant.net/blogs/cmullins
"Willy Denoyette [MVP]" <wi************ *@telenet.bewro te in message news:eP******* *******@TK2MSFT NGP03.phx.gbl.. .
Sure it does, .NET (the CLR) is LARGEADRESSAWAR E since v1.1. The only
problem is that the C# compiler doesn't have an option to set the
largeaddressawa re flag, you have to edit the PE header using editbin.
editbin /largeaddressawa re <some.exe>
Another option (framework V2)is to compile all modules as netmodules
using
the /t:module compiler flag and use the linker (link.exe) to build the
PE
file.
here is a sample of such linker command...
link /entry:someNames pace.someClass. Main /subsystem:conso le
/largeaddressawa re some.netmodule someother.netmo dule
in both cases you should see something like following when running
dumpbin
File Type: EXECUTABLE IMAGE
FILE HEADER VALUES
14C machine (x86)
3 number of sections
452C1EAA time date stamp Wed Oct 11 00:28:58 2006
0 file pointer to symbol table
0 number of symbols
E0 size of optional header
122 characteristics
Executable
Application can handle large (>2GB) addresses
32 bit word machine
Willy.
"Chris Mullins" <cm******@yahoo .comwrote in message
news:uv******** ******@TK2MSFTN GP02.phx.gbl...
| I'm pretty sure .Net doesn't respects the /3gb switch.
|
| I haven't looked in a while, but I know we did quite a bit of
performance
| tuning in 32-bit land a while back and were very crabby about this.
|
| Fortunatly 64-bit hardware came along, and life was good. I love
allocating
| 20+gb of memory! :)
|
| --
| Chris Mullins, MCSD.NET, MCPD:Enterprise
| http://www.coversant.net/blogs/cmullins
|
|
|
| "Greg Young" <dr************ *******@hotmail .comwrote in message
| news:eV******** ******@TK2MSFTN GP05.phx.gbl...
| That is a windows issue not a C# issue ..There is a 2gb process
limit
in
| windows ..
| >
| see
| > http://msdn.microsoft.com/library/de...netchapt17.asp
| search for /3 gb for instructions for how to make this larger.
| >
| Cheers,
| >
| Greg Young
| MVP - C#
| http://codebetter.com/blogs/gregyoung
| >
| "fAnSKyer/C# newbie" <fa******@gmail .comwrote in message
| news:11******** **************@ m7g2000cwm.goog legroups.com...
| >My system has 4GB memory and My program in C# is really memory
| >consuming. and I noticed that when the memory I used is more than
2GB
I
| >will get an exception.
| >>
| >How to solve this? thanks a lot
| >>
| >
| >
|
|
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Pat |
last post by:
I am using VC++ 6.0 to develop my program.
class A
{
Object *obj
public:
A() { obj=new Object ; } ;
}
|
by: Vasil Buraliev |
last post by:
Hallo. I started a solution in VS.NET with template for C# windwos
application. The solution has several projects:
-Artifacts
-BusinessRules
-Client
-ErrorLog
-Standardization
....
...
..
|
by: Tony |
last post by:
Hi expert,
I installed DB2 v8.2 server on Solaris 9 box. When I connect to DB2
using control centre or other applications(except command line),
around 12 db2sysc processes pop up and each one consumes more than 2G
memory(total 30G memory). The server only has 8G physical memory, so
DB2 costs too many memory resources. I tried to reduce the
appgroup_mem_sz and app_ctl_heap_sz, but it didn't work. What else can
I do?
|
by: sam_cit |
last post by:
Hi Everyone,
I'm in a need to allocate huge memory block of size 50kb.
How can i use malloc() for this purpose, asuming sizeof(int) is two
bytes?
Thanks in advance!!!
|
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...
| |
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,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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...
|
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...
| |
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();...
|
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...
| |