1.
Objects passed to the method are never garbage collected in that method. So p cannot be GCed.
x is not an object.
"abc" is a string literal which goes to the string pool and is not GCed.
So, only a is eligible for GC.

2. 注意方法中的參數是primitive, String ,還是Object
 2.1 如是primitive, String  通過方法後,其值不變,因為方法中改變的是方法的行參(只是一個備份而已)
 2.2 如是Object ,就要注意方法中的操作是否改變了Object的屬性,這種改變是有效的修改了Object屬性最終值

3
Simply put, there is no guarantee which thread will run when and for how much time.
In some OSs like Windows, CPU time is given to threads in ratio of there priority in some OSs like Unix a lower priority thread executes only after higher priority thread ends.
4
Java does not have a keyword name delete.
An object is only eligible for garbage collection if the only references to the object are from other objects that are also eligible for garbage collection. Therefore, if an object obj2 is eligible for garbage collection and obj1 contains a reference to it, then obj1 must also be eligible for garbage collection.
An object will not necessarily be garbage collected immediately after the last reference to the object has been removed. It depends on when the GC thread gets a chance to run. Many a times it happens that GC doesn't run for the whole life time of the program.
Circular references generally do not prevent objects from being garbage collected.
An object is not eligible for garbage collection as long as the object can be reached from the active part of the program.
An object that has been eligible for garbage collection may stop being eligible and return to normal life. This occurs if the call to the finalize() method re-establishes a reference from the active part of the program to the object.
if an object is resurrected in finalize() then it will never be finalized again.
5.
The Java language does not specify how soon a finalizer will be invoked, except to say that it will happen before the storage for the object is reused.
Also, the Java language does not specify which thread will invoke the finalizer for any given object.
If an uncaught exception is thrown during the finalization, the exception is ignored and finalization of that object terminates.

3.Garbage Collection相关推荐

  1. 细述 Java垃圾回收机制→Java Garbage Collection Monitoring and Analysis

    本文非原创,翻译自Java Garbage Collection Monitoring and Analysis 在Java中为对象分配和释放内存空间都是由垃圾回收线程自动执行完成的.和C语言不一样的 ...

  2. Java 垃圾回收机 GC Roots详解(Garbage Collection Roots)

    背景: 之前面试阿里支付宝,被问到常见的GC Root 是什么? 当时自己支支吾吾,明明自己看过深入理解Java 虚拟机这本书,但是就是回答不上来. 后来自己工作中,遇到内存泄漏问题.我百度,下载了M ...

  3. Java垃圾回收机制(Garbage Collection)

    引用博客地址:http://www.cnblogs.com/ywl925/p/3925637.html 以下两篇博客综合描述Java垃圾回收机制 第一篇:说的比较多,但是不详细 http://www. ...

  4. GC garbage collection 垃圾回收机制

    GC  garbage collection   垃圾回收机制 1 找到内存空间中的垃圾. 2.回收垃圾,让程序员可以再次利用. 满足这样的程序就是GC GC的评价性能的标准: 1吞吐量2 最大暂停时 ...

  5. Java Garbage Collection Basics--转载

    原文地址:http://www.oracle.com/webfolder/technetwork/tutorials/obe/java/gc01/index.html Overview Purpose ...

  6. Garbage Collection Optimization for High-Throughput and Low-Latency Java Applications--转载

    原文地址:https://engineering.linkedin.com/garbage-collection/garbage-collection-optimization-high-throug ...

  7. JVM-05垃圾收集Garbage Collection(中)【垃圾收集算法】

    文章目录 思维导图 标记清除算法(其他算法的基础) 复制算法(新生代的GC) 标记整理/压缩算法(老年代的GC) 标记-清除算法.复制算法.标记整理算法总结 分代收集算法(新生代的GC+老年代的GC) ...

  8. JVM-04垃圾收集Garbage Collection(上)【垃圾对象的判定】

    文章目录 思维导图 概述 如何判断对象为垃圾对象 对象的存活还是死亡 判断对象死亡的算法一:引用计数算法Reference Counting 原理 示意图 优点 缺点 实验 判断对象死亡的算法一:可达 ...

  9. 从ASP.NET Core 3.0 preview 特性,了解CLR的Garbage Collection

    前言 在阅读这篇文章:Announcing Net Core 3 Preview3的时候,我看到了这样一个特性: Docker and cgroup memory Limits We conclude ...

  10. 细述 Java垃圾回收机制→How Java Garbage Collection Works?

    本文非原创,翻译自How Java Garbage Collection Works? 在Java中为对象分配和释放内存空间都是由垃圾回收线程自动执行完成的.和C语言不一样的是Java程序员不需要手动 ...

最新文章

  1. db2 某个字段排序_sql字段排序 rank over
  2. python和shell哪个快_有没有可能让这个shell脚本更快?
  3. 漫画 | 这样的男朋友,让我分分钟想剖腹自尽!
  4. python -sorted 学习
  5. sqlplus补丁包rlwrap-0.37的安装步骤(解决SQL的删除、上翻历史命令等)
  6. Valid Parentheses
  7. jquery中filter(fn)的使用研究
  8. python复数什么意思_python 复数是什么意思
  9. Albumentation使用指南
  10. HIVE 系列 (4) hive 内部表和外部表HQL查询统计
  11. [ thanos源码分析系列 ]thanos sidecar组件源码简析
  12. 如何查找【期刊】IEEE transaction on XXX 相关论文
  13. 【创文进行时】创建文明城市社区在行动
  14. 程序员学习指南_程序员管理压力指南
  15. 2020,不会分布式怎么可以,这2份pdf共1000+,从原理到系统实现都包含了
  16. AAAI 2023:清华SIGS信息学部19篇论文入选,含多模态、目标检测、语义分割等方向...
  17. 男人为什么容易掉头发?
  18. 2020焊工(技师)考试及焊工(技师)模拟考试系统
  19. 2019年04月01日_拔剑-浆糊的传说_新浪博客
  20. 车联网联盟发布数字秘钥3.0版规范

热门文章

  1. 微型计算机原理与接口技术——8086指令系统之数据传送指令
  2. Android 动态代理以及利用动态代理实现 ServiceHook
  3. Android 点击按钮带有震动效果,使用Vibrator
  4. AVPro Movie Capture☀️一、一款U3D录屏插件介绍
  5. 教会你ECshop安装百度分享按钮教程
  6. eclipse配置python开发环境_Eclipse配置Python的环境
  7. js计算时间差,包括计算,天,时,分,秒
  8. 万能密码或账号登录语句
  9. Day1—图片动态过渡
  10. 系统迁移里踩过的一点小坑