C函数内存分配 [英] C function memory allocation

查看:124
本文介绍了C函数内存分配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在C,在什么时候是分配的功能,在内存中它去了?

In C, at what time is a function allocated and where in memory does it go?

是当程序被编译第一或当函数调用第一次看到它分配划拨的记忆?难道是在栈或在code段分配呢?

Is the memory for a function allocated when the program is compiled first or is it allocated when the function call is seen first? Is it allocated on the stack or in a code segment?

推荐答案

对于C函数的内存总是从当时的功能被加载到内存中的code段分配。如果一个函数属于动态链接库,该程序可能加载并在任意时间卸载。

The memory for C functions is always allocated from the code segment at the time the functions are loaded into memory. If a function belongs to a dynamically linked library, the program may load and unload it at arbitrary times.

这篇关于C函数内存分配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆