Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of Utility memory size

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you the Utility memory size of the example analysis, I believe that most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to understand it!

Although there are more and more 64-bit processors, and VxWorks has been supporting 64-bit processors since 6.9, more application scenarios of VxWorks are still 32-bit. So how much memory can VxWorks use on 32-bit processors at most?

The addressing range of a 32-bit system is 232 = 4G, but at least some space must be reserved for peripherals, so the range of memory that can be used must be smaller than that of 4GB. Do an experiment: insert a 4GB memory stick into the X86 device

Use LOCAL_MEM_AUTOSIZE mode

Start VxWorks, and the memory size is displayed as 3071MB

Take a look at where the Top point of memory is, which can be obtained by the function sysPhysMemTop (), which is 3GB=3072MB

Where's the missing MB? It turns out that the memory of X86 is calculated from 0x100000.

Can I use this 3071MB freely? Of course not

The approximate layout of the memory is as follows

Take a look at one by one

In the area between LOCAL_MEM_LOCAL_ADRS and RAM_LOW_ADRS, the VxWorks system stores some specific data

For example, Boot line, in LOCAL_MEM_LOCAL_ADRS+ BOOT_LINE_OFFSET

Starting with RAM_LOW_ADRS, the VxWorks system image is stored. When compiling, a global variable end is added to the tail of the image, so the size of the image can be calculated through end.

In fact, this size is determined at compile time, but there is a slight deviation because of the alignment.

Looking down from the top of the memory, there are two reserved areas. The above block is reserved for the EDR mechanism, and its size defaults to 24KB (PM_RESERVED_MEM = 6*VM_PAGE_SIZE)

The next piece is the user reservation area, which is USER_RESERVED_MEM in size.

The starting position of this area can be obtained by the function sysMemTop ()

You can see that the value is the same as sysPhysMemTop (), because neither of these two reserved areas is enabled by default in the current image, so the size is still 0.

The area between end and sysMemTop () can be divided into three parts.

Starting from end, store the WDB memory pool. The space occupied by WDB_POOL_SIZE is (sysMemTop ()-end) / 16 by default.

After WDB, there is the system memory pool, and the default size KERNEL_HEAP_SIZE is (sysMemTop ()-FREE_MEM_START_ADRS) / 3x2 = WDB_POOL_SIZE*10.

The last remaining piece is reserved for RTP or shared libraries or shared data areas, and when they are loaded, they are dynamically mapped. Its size is (sysMemTop ()-end) minus WDB memory pool and system memory pool, so it is equal to WDB_POOL_SIZE*5 by default

What is the maximum size of the system memory pool? Then remove the other optional areas: WDB memory pool, RTP, user reservation, EDR area. The system memory pool is (sysPhysMemTop ()-end): 3GB minus several MB before RAM_LOW_ADRS, and then subtract several MB of system image

The above is all the contents of the article "sample Analysis of Utility memory size". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report