小结:

1、不可访问内存是指一组没有任何可访问指针指向的由计算机程序进行动态分配的内存块。

2、垃圾收集器能决定是否一个对象还是可访问的;任何被确定不可访问的对象将会被释放。

https://zh.wikipedia.org/wiki/不可访问内存

计算机科学中,不可访问内存是指一组没有任何可访问指针指向的由计算机程序进行动态分配的内存块。类似的,一个不可访问对象是指没有可访问引用型指向的动态分配对象。通俗来说,不可访问内存是程序无法直接访问的动态内存,同时也无法通过指针指向一个可访问的起始对象来进行访问。

动态内存分配的实现是采用了垃圾回收机制,在一个对象不可访问后,它会被回收。垃圾收集器能决定是否一个对象还是可访问的;任何被确定不可访问的对象将会被释放。在许多编程语言中(例如:JavaC#D语言Dylan)都使用了自动垃圾回收机制。

相反的,在动态内存分配机制中,当需要明确释放的内存变得不可访问时,此内存可以不再明确释放。在使用人工内存管理中,系统中的不可访问内存会导致内存泄漏

一些垃圾收集器使用弱引用。如果一个对象能够通过弱引用或者包含弱引用的链接,那么这个对象可以被称为弱访问。垃圾收集器能够把弱访问的对象图视为不可访问的,并且释放它。(反过来说,防止对象被当作垃圾收集的引用被称为强引用;通过只含有强引用的链接来访问的弱可访问对象是不可访问的。)一些垃圾回收的面向对象语言,例如JavaPython,拥有弱引用的特性。Java包java.lang.ref提供了软引用,弱引用和虚引用,产生了其他对象访问状态可软访问可虚访问

不可访问内存往往和软件老化有关。

参见

外部链接

A useful discussion can be found at Ethan Nicholas's Blog

Unreachable memory - Wikipedia https://en.wikipedia.org/wiki/Unreachable_memory

In computer scienceunreachable memory is a block of memory allocated dynamically where the program that allocated the memory no longer has any reachable pointer that refers to it. Similarly, an unreachable object is a dynamically allocated object that has no reachable reference to it. Informally, unreachable memory is dynamic memory that the program can not reach directly, nor get to by starting at an object it can reach directly, and then following a chain of pointer references.

In dynamic memory allocation implementations that employ a garbage collector, objects are reclaimed after they become unreachable. The garbage collector is able to determine if an object is reachable; any object that is determined to no longer be reachable can be deallocated. Many programming languages (for example, JavaC#DDylan) use automatic garbage collection.

In contrast, when memory becomes unreachable in dynamic memory allocation implementations that require explicit deallocation, the memory can no longer be explicitly deallocated. Unreachable memory in systems that use manual memory management results in a memory leak.

Some garbage collectors implement weak references. If an object is reachable only through either weak references or chains of references that include a weak reference, then the object is said to be weakly reachable. The garbage collector can treat a weakly reachable object graph as unreachable and deallocate it. (Conversely, references that prevent an object from being garbage collected are called strong references; a weakly reachable object is unreachable by any chain consisting only of strong references.) Some garbage-collected object-oriented languages, such as Java and Python, feature weak references. The Java package java.lang.ref supports soft, weak and phantom references, resulting in the additional object reachability states softly reachable and phantom reachable.

Unreachable memory is often associated with software aging.

External links

Java四种引用包括强引用,软引用,弱引用,虚引用。 - 一步一个脚印,坚持 - 博客园
https://www.cnblogs.com/yw-ah/p/5830458.html

最新文章

  1. 渗透日记-POST注入
  2. Struts2笔记——struts常用标签
  3. 51Nod 1405 树的距离之和 (树dp)
  4. 【转】字符串分割(C++)
  5. 关于PHPExcel
  6. asp.net MVC Razor 语法(3)
  7. 飘逸的python - zlib压缩存到数据库
  8. Android控件上添加图片
  9. Maven依赖的是本地工程还是仓库jar包?
  10. Java进阶(十八)Java实现定时器(Timer)
  11. pycharm破解
  12. TCP连接数过多问题
  13. (转)Linux 系统设置 : dmesg 命令详解
  14. Spring Boot学习笔记 - 整合Swagger2自动生成RESTful API文档
  15. ZedBoard上运行linux系统的准备工作框架
  16. Astah Professional安装
  17. jvm特性(3)( 收集算法和收集器的概念)
  18. Beta发布—视频展示
  19. 设置view controller到iPhone或者iPad模式
  20. Android Studion有用的快捷键

热门文章

  1. springboot 中打印 sql 语句
  2. 总结Sql Server内置函数实现MD5加密
  3. CSS实现响应式全屏背景图
  4. Java知多少(47)多重catch语句的使用
  5. Java知多少(64)线程死锁
  6. FPGA编程—组合逻辑编码器等verilog实现
  7. Mysql系列六:(Mycat分片路由原理、Mycat常用分片规则及对应源码介绍)
  8. Linux时间变慢解决方法
  9. 在IDEA中将项目部署到Tomcat的方法及两种模式的区别
  10. java.util.HashMap的简单介绍