You don't know.-Set the base address for the internal process.

Source: Internet
Author: User

When project analyzer is used to analyze the code of a VB6 DLL project, the following warning is displayed:

Problem description-wfwkernel
 
Base Address unoptimal: wfwkernel
 
Type optimization
Severity warning
Location wfwkernel. VBP
 
Description
 
A library project's base address is set to the default value (& h11000000) in project options. when loading the library, the operating system tries to load it at this address. if not possible, it relocates the library. changing this address to another value will help to reduce the likelihood of relocation, thus making the library load faster. the base address affects ActiveX ocx, ActiveX DLL and. net class library projects. notice that in. net projects, different deployments (debug/release) can have different base address values. the rule works on the currently selected configuration.

Project analyzer 7.0.05 (2006-2-13)

Why? What is the base address unoptimal warning?

The msdn explanation is as follows:

Set the base address for the process Internals

In a 32-bit operating system, as long as the component is loaded on its base address, each process using the component can share the code page of the process's internal component (. dll or. ocx file. In this way, three customer applications can use the controls in the components, and the code only needs to be loaded to the memory once.
On the contrary, if the memory address used by the process internal component conflicts with the memory address used by another process internal component or executable program, the component must be reconfigured to another logical memory location in the executable process space.
To reset the base address, the operating system needs to dynamically recalculate the logic memory location for code and data loading. This type of re-calculation slows down the process loading, and the code that is dynamically relocated cannot be shared by executable files.
Reasonable selection of the base address can greatly improve the memory usage of the component.

Set base address

Enter the base address of the part, open the "Project Properties" dialog box, and select the "compile" tab. In the "DLL base address" box, enter the address in an unsigned decimal or hexadecimal integer.
The default value is & h11000000 (285,212,672 ). If this value is not changed, the part conflicts with each internal part of the process compiled using the default value. We recommend that you use a base address away from this address.
Select base address
Select the base address between 16 m (16,777,216 or & h000000) bytes and 2g (2,147,483,648 or & h80000000) bytes.
The base address must be a multiple of 64 KB. The memory used by the component starts from the initial base address. The size of the compiled file is rounded to a multiple of 64 KB.
The program cannot be larger than 2g. Therefore, the maximum base address is actually 2G bytes minus the memory size used by the part.
Note that executable files are generally loaded at 4 MB logical addresses. Areas smaller than 4 MB are reserved for Windows 95, while areas larger than 2 GB are reserved for Windows 95 and Windows NT.

Use a good random number generator

Because you cannot know the base address used by other processes, the most practical method is to randomly select an address within the specified range and rounding it to a multiple of 64 K.
If the company creates many internal process parts, it randomly calculates the base address for the first part, and the address of other parts is far away from the address of the first part. In this way, at least one company's components won't have memory conflicts.

Well, it turns out, but how many people are processing the base address when doing the DLL? How many other people use P7 for code check?

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.