TAILIEUCHUNG - Implementing Database Security and Auditing phần 2

Bộ nhớ được cố định cho chương trình chẳng hạn như mã dữ liệu tĩnh, và chỉ đọc dữ liệu heap, được sử dụng khi một chương trình tự động cấp phát bộ nhớ sử dụng malloc hoặc sử dụng mới stack, được sử dụng khi gọi các phương pháp và chức năng | 26 Patch your database 1. Memory that is fixed for the program such as the code itself static data and read-only data 2. The heap which is used when a program dynamically allocates memory using malloc or using new 3. The stack which is used when calling methods and functions In order to use all memory allotted for a process by the operating system most computers manage the process memory as shown in Figure . The fixed parts including the code and any static memory are loaded at the bottom of the address space usually not exactly at 0x00000000 but not far from it . Then comes the heap which grows from low addresses to high addresses. If you continuously allocate variables on the heap they will increasingly live in higher memory. Because both the heap and the stack may dynamically grow the heap when you allocate more memory and the stack when you make more function calls the operating system maximizes the usage of memory and minimizes the work it has to do by making the stack grow from high address spaces to low address spaces. As an example if your main calls foo which in turn calls bar and then your stack will include the segments for each of these functions as shown in Figure . ----------------- Figure Memory layout for an operating system process. Patch your database 27 --------------- Figure Stack grows down from high memory to low memory . The stack is used to manage the entire function calling process including parameter passing and return values. When a function is called the function s parameters are pushed onto the stack. Then an area is allocated for the return address. Then the frame pointer is pushed onto the stack the frame pointer is used to reference the local variables and the function parameters that are always at fixed offsets from the frame pointer . Then the function s local automatic variables are allocated. At this point the program can run the function s code and has all of the required variables available. As an example

Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.