C #. Net x86 use of large memory processing

Source: Internet
Author: User

The/LARGEADDRESSAWARE option notifies the linker application to handle addresses larger than 2 GB. in the 64-bit compiler, this option is enabled by default. In a 32-bit compiler,/largeaddressaware:no is enabled if/largeaddressaware is not specified on the linker line.

If you use/largeaddressaware to link an application, Dumpbin/headers displays information about the effect.

Set this linker option in the Visual Studio development environment
  1. Open the Property Pages dialog box for the project. For more information, see Setting Visual C + + project properties.

  2. Click the linker folder.

  3. Click the System property page.

  4. Modify the Enable large addresses property.

Do not need to largeaddressaware all Windows programs will be able to use 2g of memory, 2g or more need largeaddressaware, within 2g if your program in the allocation of large memory times OutOfMemory exception, In general, there are several situations:


1. Insufficient memory available
2. You start the program in VS2005 mode, and in the options of the project properties, you enable the VS2005 self-hosted mode debugging. VS2005 's own debug hosting environment seems to provide only 1g of memory address space.
3. A dynamically adjusted collection object is used, but capacity is not specified. such as arraylist,hashtable and so on. A collection object that uses dynamic adjustment when large memory needs to be requested must force the capacity upper bound, because the set dynamically adjusts the amount of memory required for capacity to be 3 times times the number of count. If you have free 2g of memory, using ArrayList without specifying Capacity,capacity is a double-growth strategy, When capacity uses 1g to add elements, the. NET requests 2g of space, which costs 3g of memory before you copy all the elements to the new memory.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.