是否可以使用JVM字节码显式释放内存? [英] Is it possible to explicitly free memory with JVM Bytecode?

查看:60
本文介绍了是否可以使用JVM字节码显式释放内存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几种计算机编程语言使用JVM字节码作为其目标语言口译员/编译器.在我看来,许多新的编程语言(不到15年的历史)都在JVM上运行,我想知道是否对所有这些语言都禁止显式的内存释放:

There are several computer programming languages using JVM bytecode as, lets say, target language for their interpreter/compilers. It seems to me that many new programming languages (less than 15 years old) run over JVM and I wonder whether explicit memory deallocation is forbidden for all of them:

是否可以通过任何指令在字节码中显式分配内存?相反,垃圾收集器是否总是可用于释放内存?

Is it possible to explicitly allocate-deallocate memory using in bytecode through any instruction? Is, on de contrary, the garbage collector always resposible for memory liberation?

推荐答案

JVM取消了所有内存管理.没有用于内存释放的字节码,就像没有用于内存分配或直接内存访问的字节码一样.如果要这样做,则必须直接或间接使用本机代码.

The JVM abstracts away all memory management. There is no bytecode for memory deallocation, just as there is no bytecode for memory allocation or direct memory access. If you want to do that, you have to use native code, directly or indirectly.

这篇关于是否可以使用JVM字节码显式释放内存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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