大网数据广告活动
网络与域名解析

Introduction to RPC Memory Management

· 52CE 我爱测

Introduction to Remote Procedure Call (RPC) memory management.

In the context of RPC, memory management involves:

  • Allocating and deallocating the memory needed to simulate a single conceptual address space between the client and the server in the different address spaces of the client and server's threads.
  • Determining which software component is responsible for managing memory — the application or the MIDL-generated stub.
  • Selecting MIDL attributes that affect memory management: directional attributes, pointer attributes, array attributes, and the ACF attributes [ byte_count], [ allocate], and [ enable_allocate].

When a program calls a function or procedure in its address space, memory management is more straightforward than in a distributed application. To illustrate, the following diagram depicts a binary tree. To pass this data structure to a procedure in its address space, a program simply passes a pointer to the root of the tree.

a binary tree, with pointers to structure data housed at the root of the tree

Client/server RPC applications share data across two different memory spaces. These memory spaces may or may not be on the same computer. Either way, the client and server have no direct access to each other's memory space. RPC depends on the ability to simulate the client program's address space in the server program's address space. It must also return data, including new and changed data, from the server to the client memory.

In cases such as the binary tree depicted in the preceding diagram, it is not sufficient to pass a pointer to the root node to a remote procedure. Either the program or the stubs must pass the entire tree to the server's address space for the remote procedure to operate on it.

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。