大地址,內存

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

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