大地址,内存

https://blog.csdn.net/chuiwenwei_csdn/article/details/51131360

 

作者:炊文伟

邮箱:[email protected]

专注于以安全为核心的平安城市,智能交通,智能家居软件平台解决方案设计与开发

概述:

    在目前很多机器都使用8G内存情况下,很多软件却无法有效使用更高内存,本文主要简述使用C#语言开发的应用程序,使用系统自带的Editbin工具开启3G大内存使用。


详细步骤(以VS2015举例):

    第一步:找到editbin.exe文件

格式:VS版本\VC\bin\editbin.exe

以我机器为例其位于VS软件安装目录下:C:\Program Files (x86)\MicrosoftVisual Studio 14.0\VC\bin\editbin.exe


 

    第二步:执行开启大地址命令

命令格式:/largeaddressaware  exe文件路径

以我机器下一个WindowsFormsApplication1程序(.Net4.0)为例:

/largeaddressaware  C:\Users\chuiwenwei\Desktop\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.exe


命令行中运行如下:

C:\ProgramFiles (x86)\Microsoft Visual Studio 14.0\VC\bin>editbin /largeaddressawareC:\Users\chuiwenwei\Desktop\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.exe

 

    第三步:运行后如下所示:

C:\ProgramFiles (x86)\Microsoft Visual Studio 14.0\VC\bin>editbin /largeaddressawareC:\Users\chuiwenwei\Desktop\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.exe

Microsoft(R) COFF/PE Editor Version 14.00.23026.0

Copyright(C) Microsoft Corporation.  All rightsreserved.

 

    第四步:验证是否确实开启了大地址

在editbin.exe文件上方可以看到dumbin.exe文件。

命令格式:/headersexe文件路径

以我机器下刚才设置的WindowsFormsApplication1程序(.Net4.0)为例:

C:\ProgramFiles (x86)\Microsoft Visual Studio 14.0\VC\bin>dumpbin /headersC:\Users\chuiwenwei\Desktop\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.exe

 

    第五步:显示如下信息即可确认获取信息成功

C:\ProgramFiles (x86)\Microsoft Visual Studio 14.0\VC\bin>dumpbin /headersC:\Users\chuiwenwei\Desktop\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.exe

Microsoft(R) COFF/PE Dumper Version 14.00.23026.0

Copyright(C) Microsoft Corporation.  All rightsreserved.

 

 

Dump offileC:\Users\chuiwenwei\Desktop\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.exe

 

PEsignature found

 

FileType: EXECUTABLE IMAGE

 

FILEHEADER VALUES

             14C machine (x86)

               3 number of sections

        56E7F29F time date stamp Tue Mar 1519:31:43 2016

               0 file pointer to symbol table

               0 number of symbols

              E0 size of optional header

              22 characteristics

                   Executable

                   Application can handle large(>2GB) addresses

 

OPTIONALHEADER VALUES

             10B magic # (PE32)

           48.00 linker version

            1200 size of code

             A00 size of initialized data

              0 size of uninitialized data

            3002 entry point (00403002)

            2000 base of code

            4000 base of data

          400000 image base (00400000 to00407FFF)

            2000 section alignment

             200 file alignment

            4.00 operating system version

            0.00 image version

            4.00 subsystem version

               0 Win32 version

            8000 size of image

             200 size of headers

            1E14 checksum

               2 subsystem (Windows GUI)

            8540 DLL characteristics

                   Dynamic base

                   NX compatible

                   No structured exceptionhandler

                   Terminal Server Aware

          100000 size of stack reserve

            1000 size of stack commit

          100000 size of heap reserve

            1000 size of heap commit

               0 loader flags

              10 number of directories

               0 [       0] RVA [size] of Export Directory

            2FAD [      4F] RVA [size] of Import Directory

            4000 [     62C] RVA [size] of Resource Directory

               0 [       0] RVA [size] of Exception Directory

               0 [       0] RVA [size] of Certificates Directory

            6000 [       C]RVA [size] of Base Relocation Directory

            2F04 [      1C] RVA [size] of Debug Directory

               0 [       0] RVA [size] of Architecture Directory

               0 [       0] RVA [size] of Global PointerDirectory

               0 [       0]RVA [size] of Thread Storage Directory

               0 [       0] RVA [size] of Load ConfigurationDirectory

               0 [       0] RVA [size] of Bound Import Directory

            2000 [       8] RVA [size] of Import Address TableDirectory

               0 [       0] RVA [size] of Delay Import Directory

            2008 [      48] RVA [size] of COM DescriptorDirectory

               0 [       0] RVA [size] of Reserved Directory

 

 

SECTIONHEADER #1

   .text name

    1008 virtual size

    2000 virtual address (00402000 to 00403007)

    1200 size of raw data

     200 file pointer to raw data (00000200 to000013FF)

       0 file pointer to relocation table

       0 file pointer to line numbers

       0 number of relocations

       0 number of line numbers

60000020flags

         Code

         Execute Read

 

  Debug Directories

 

        Time Type        Size      RVA Pointer

    -------- ------- -------- -------- --------

    56E7F29E cv            8D 00002F20     1120   Format: RSDS, {D72A86FA-9265-4A90-9885-AEED19611EC0}, 1,C:\Users\chuiwenwei\Desktop\WindowsFormsApplication1\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.pdb

 

SECTIONHEADER #2

   .rsrc name

     62C virtual size

    4000 virtual address (00404000 to 0040462B)

     800 size of raw data

    1400 file pointer to raw data (00001400 to00001BFF)

       0 file pointer to relocation table

       0 file pointer to line numbers

       0 number of relocations

       0 number of line numbers

40000040flags

         Initialized Data

         Read Only

 

SECTIONHEADER #3

  .reloc name

       C virtual size

    6000 virtual address (00406000 to 0040600B)

     200 size of raw data

    1C00 file pointer to raw data (00001C00 to00001DFF)

       0 file pointer to relocation table

       0 file pointer to line numbers

       0 number of relocations

       0 number of line numbers

42000040flags

         Initialized Data

         Discardable

         Read Only

 

  Summary

 

        2000 .reloc

        2000 .rsrc

        2000 .text

 

    第六步:如果可以Application can handle large (>2GB)addresses就说明设置大地址成功
————————————————
版权声明:本文为CSDN博主「chuiwenwei_csdn」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/chuiwenwei_csdn/article/details/51131360

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章