Knowledge (XXG)

Phantom reference

Source 📝

799: 386: 764: 776: 181: 22: 164:
method, guaranteeing that the object is not resurrected during finalization. This allows the object to be garbage collected in a single cycle, rather than needing to wait for a second GC cycle to ensure that it has not been resurrected. A second use is to detect exactly when an object has been
151:
In Java 8 and earlier versions, the reference needs to be cleared before the memory for a finalized referent can be reclaimed. A change in Java 9 will allow memory from a finalized referent to be reclaimable immediately.
319: 169:
object), ensuring that its memory is available, for example deferring allocation of a large amount of memory (e.g., a large image) until previous memory is freed.
869: 840: 271: 312: 768: 39: 305: 105: 138:. Phantom reference are the weakest level of reference in Java; in order from strongest to weakest, they are: strong, soft, weak, 86: 859: 353: 58: 646: 43: 716: 626: 611: 65: 833: 641: 370: 347: 780: 596: 476: 256: 186: 123: 864: 692: 72: 32: 636: 578: 328: 229: 54: 826: 663: 160:
Phantom references are of limited use, primarily narrow technical uses. First, it can be used instead of a
702: 568: 425: 400: 588: 517: 279: 806: 563: 456: 415: 405: 342: 126:, where the memory can be reclaimed. The phantom reference is one of the strengths or levels of 'non 707: 697: 507: 497: 209: 798: 79: 810: 747: 712: 573: 532: 127: 385: 257:"hg: jdk9/hs-rt/jdk: 8071507: (ref) Clear phantom reference as soft and weak references do" 737: 446: 542: 512: 492: 466: 204: 199: 135: 131: 853: 742: 732: 537: 502: 461: 775: 441: 180: 21: 631: 359: 176: 601: 365: 194: 145: 297: 671: 606: 547: 527: 522: 471: 410: 375: 130:' reference defined in the Java programming language; the others being 676: 621: 451: 420: 616: 301: 15: 814: 234:
Java™ Platform, Standard Edition 8 API Specification
165:
removed from memory (by using in combination with a
144:
An object is phantomly referenced after it has been
725: 685: 662: 655: 587: 556: 485: 434: 393: 335: 46:. Unsourced material may be challenged and removed. 255:oracle.com, kim barrett at (28 December 2015). 834: 313: 8: 841: 827: 659: 320: 306: 298: 106:Learn how and when to remove this message 221: 230:"java.lang.ref (Java Platform SE 8 )" 7: 795: 793: 44:adding citations to reliable sources 813:. You can help Knowledge (XXG) by 14: 870:Programming language topic stubs 797: 774: 763: 762: 384: 179: 20: 781:Computer programming portal 272:"Understanding Weak References" 270:Nicholas, Ethan (May 4, 2006). 31:needs additional citations for 486:Major third-party technologies 1: 717:Sun Microsystems Laboratories 187:Computer programming portal 886: 792: 693:Apache Software Foundation 122:is a kind of reference in 760: 579:Free Java implementations 382: 329:Java (software platform) 860:Programming constructs 809:-related article is a 703:Java Community Process 569:Java Community Process 435:Platform technologies 807:programming-language 564:Java version history 416:Java virtual machine 406:Java Development Kit 40:improve this article 394:Oracle technologies 55:"Phantom reference" 708:Oracle Corporation 698:Eclipse Foundation 282:on August 19, 2010 210:Circular reference 865:Memory management 822: 821: 787: 786: 756: 755: 120:phantom reference 116: 115: 108: 90: 877: 843: 836: 829: 801: 794: 779: 778: 766: 765: 748:Patrick Naughton 713:Sun Microsystems 660: 574:Sun Microsystems 467:Web Start (JNLP) 388: 322: 315: 308: 299: 292: 291: 289: 287: 278:. Archived from 267: 261: 260: 252: 246: 245: 243: 241: 226: 189: 184: 183: 168: 163: 111: 104: 100: 97: 91: 89: 48: 24: 16: 885: 884: 880: 879: 878: 876: 875: 874: 850: 849: 848: 847: 790: 788: 783: 773: 752: 738:Arthur van Hoff 721: 681: 651: 583: 552: 481: 430: 389: 380: 331: 326: 296: 295: 285: 283: 269: 268: 264: 254: 253: 249: 239: 237: 228: 227: 223: 218: 185: 178: 175: 166: 161: 158: 112: 101: 95: 92: 49: 47: 37: 25: 12: 11: 5: 883: 881: 873: 872: 867: 862: 852: 851: 846: 845: 838: 831: 823: 820: 819: 802: 785: 784: 761: 758: 757: 754: 753: 751: 750: 745: 740: 735: 729: 727: 723: 722: 720: 719: 710: 705: 700: 695: 689: 687: 683: 682: 680: 679: 674: 668: 666: 657: 653: 652: 650: 649: 644: 639: 634: 629: 624: 619: 614: 609: 604: 599: 593: 591: 585: 584: 582: 581: 576: 571: 566: 560: 558: 554: 553: 551: 550: 545: 540: 535: 530: 525: 520: 515: 510: 505: 500: 495: 489: 487: 483: 482: 480: 479: 474: 469: 464: 459: 454: 449: 444: 438: 436: 432: 431: 429: 428: 423: 418: 413: 408: 403: 397: 395: 391: 390: 383: 381: 379: 378: 373: 368: 363: 357: 351: 345: 339: 337: 333: 332: 327: 325: 324: 317: 310: 302: 294: 293: 262: 247: 220: 219: 217: 214: 213: 212: 207: 205:Soft reference 202: 200:Weak reference 197: 191: 190: 174: 171: 167:ReferenceQueue 157: 154: 114: 113: 28: 26: 19: 13: 10: 9: 6: 4: 3: 2: 882: 871: 868: 866: 863: 861: 858: 857: 855: 844: 839: 837: 832: 830: 825: 824: 818: 816: 812: 808: 803: 800: 796: 791: 782: 777: 771: 770: 759: 749: 746: 744: 741: 739: 736: 734: 733:James Gosling 731: 730: 728: 724: 718: 714: 711: 709: 706: 704: 701: 699: 696: 694: 691: 690: 688: 686:Organizations 684: 678: 675: 673: 670: 669: 667: 665: 661: 658: 654: 648: 645: 643: 640: 638: 635: 633: 630: 628: 625: 623: 620: 618: 615: 613: 610: 608: 605: 603: 600: 598: 595: 594: 592: 590: 589:JVM languages 586: 580: 577: 575: 572: 570: 567: 565: 562: 561: 559: 555: 549: 546: 544: 541: 539: 536: 534: 531: 529: 526: 524: 521: 519: 516: 514: 511: 509: 506: 504: 503:GNU Classpath 501: 499: 496: 494: 491: 490: 488: 484: 478: 475: 473: 470: 468: 465: 463: 460: 458: 455: 453: 450: 448: 445: 443: 440: 439: 437: 433: 427: 424: 422: 419: 417: 414: 412: 409: 407: 404: 402: 399: 398: 396: 392: 387: 377: 374: 372: 369: 367: 364: 361: 358: 355: 352: 349: 346: 344: 341: 340: 338: 334: 330: 323: 318: 316: 311: 309: 304: 303: 300: 281: 277: 273: 266: 263: 258: 251: 248: 235: 231: 225: 222: 215: 211: 208: 206: 203: 201: 198: 196: 193: 192: 188: 182: 177: 172: 170: 155: 153: 149: 147: 142: 141: 137: 133: 129: 125: 121: 110: 107: 99: 88: 85: 81: 78: 74: 71: 67: 64: 60: 57: –  56: 52: 51:Find sources: 45: 41: 35: 34: 29:This article 27: 23: 18: 17: 815:expanding it 804: 789: 767: 362:(Enterprise) 284:. Retrieved 280:the original 276:www.java.net 275: 265: 250: 238:. Retrieved 233: 224: 159: 150: 143: 139: 119: 117: 102: 93: 83: 76: 69: 62: 50: 38:Please help 33:verification 30: 664:Conferences 371:Android SDK 854:Categories 743:Urs Hölzle 632:Processing 360:Jakarta EE 356:(Standard) 286:October 1, 216:References 66:newspapers 656:Community 602:BeanShell 518:Hibernate 493:Blackdown 426:Maxine VM 366:Java Card 336:Platforms 195:Ephemeron 146:finalized 769:Category 447:Servlets 240:6 August 236:. Oracle 173:See also 162:finalize 140:phantom. 96:May 2009 772:  672:JavaOne 647:Oxygene 607:Clojure 557:History 548:WildFly 543:TopLink 528:Jazelle 523:IcedTea 513:Harmony 498:Eclipse 477:Modules 472:Pack200 452:MIDlets 442:Applets 411:OpenJDK 376:GraalVM 354:Java SE 350:(Micro) 348:Java ME 80:scholar 726:People 677:Devoxx 627:Kotlin 622:Jython 612:Groovy 538:Struts 533:Spring 421:JavaFX 401:Squawk 128:strong 82:  75:  68:  61:  53:  805:This 642:Scala 637:Rhino 617:JRuby 87:JSTOR 73:books 811:stub 597:Java 288:2010 242:2016 136:soft 134:and 132:weak 124:Java 59:news 508:GWT 462:JSF 457:JSP 343:JVM 156:Use 42:by 856:: 715:, 274:. 232:. 148:. 118:A 842:e 835:t 828:v 817:. 321:e 314:t 307:v 290:. 259:. 244:. 109:) 103:( 98:) 94:( 84:· 77:· 70:· 63:· 36:.

Index


verification
improve this article
adding citations to reliable sources
"Phantom reference"
news
newspapers
books
scholar
JSTOR
Learn how and when to remove this message
Java
strong
weak
soft
finalized
icon
Computer programming portal
Ephemeron
Weak reference
Soft reference
Circular reference
"java.lang.ref (Java Platform SE 8 )"
"hg: jdk9/hs-rt/jdk: 8071507: (ref) Clear phantom reference as soft and weak references do"
"Understanding Weak References"
the original
v
t
e
Java (software platform)

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.