函数定义在哪里?在堆栈中还是在堆中?

问题描述

当我们定义一个函数时,它的内存分区在哪里?在堆栈上喜欢原始数据类型吗?还是像对象一样在堆上?

解决方法

函数是对象。因此,函数的标识符在堆栈中,而函数的值存储在堆中。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...