Tag

Constant Pool

1 views collected around this technical thread.

Lobster Programming
Lobster Programming
Dec 20, 2024 · Fundamentals

Unlocking Java’s Constant Pools: Class, Runtime, and String Explained

This article explains Java’s constant pools, detailing the class constant pool stored in .class files, its transformation into the runtime constant pool during JVM loading, and the specialized string constant pool that optimizes memory usage, including recent changes moving it to heap memory.

Constant PoolJVMJava
0 likes · 3 min read
Unlocking Java’s Constant Pools: Class, Runtime, and String Explained
Lobster Programming
Lobster Programming
Dec 16, 2024 · Fundamentals

How Many Objects Does Java Create for Different String Initializations?

This article explains how Java creates objects for various String assignments—using new String("long"), a literal "long", or concatenated literals "lo" + "ng"—detailing when one or two objects are allocated based on the presence of the literal in the string constant pool.

Constant PoolJavaMemory Management
0 likes · 3 min read
How Many Objects Does Java Create for Different String Initializations?
Top Architecture Tech Stack
Top Architecture Tech Stack
Oct 16, 2023 · Fundamentals

Understanding JVM Platform Independence and Class File Structure

This article explains how the Java Virtual Machine achieves platform and language independence, details the compilation process from source code to class files, and provides an in‑depth analysis of the class file format, constant pool, bytecode instructions, access flags, and related metadata.

Constant PoolJVMJava
0 likes · 14 min read
Understanding JVM Platform Independence and Class File Structure
政采云技术
政采云技术
Dec 13, 2022 · Frontend Development

Understanding the Shape of JavaScript Code in V8 Memory: Stack, Heap, and Constant Pool

This article explains how JavaScript code is represented in V8's memory, covering primitive types, the roles of the stack, heap, and constant pool, as well as function prototypes, variable hoisting, and garbage collection, with clear examples and diagrams.

Constant PoolHeapJavaScript
0 likes · 12 min read
Understanding the Shape of JavaScript Code in V8 Memory: Stack, Heap, and Constant Pool
Top Architect
Top Architect
Nov 17, 2022 · Fundamentals

Understanding Java String Object Creation and Memory Allocation

This article explains how Java handles string literals and new String objects, detailing the creation of objects in the constant pool and heap, the resulting memory layout, and the outcomes of reference comparisons, while also providing code examples and additional resources.

Constant PoolJavaMemory Management
0 likes · 5 min read
Understanding Java String Object Creation and Memory Allocation
Selected Java Interview Questions
Selected Java Interview Questions
Jul 2, 2022 · Backend Development

Understanding Java String Constant Pool and the Behavior of String.intern() Across JDK Versions

This article explains the Java constant pool concept, details how the String constant pool works in different JDK versions, demonstrates the effects of String.intern() with code examples, and discusses practical applications and pitfalls of using intern for memory optimization and synchronization.

Backend DevelopmentConstant PoolJVM
0 likes · 16 min read
Understanding Java String Constant Pool and the Behavior of String.intern() Across JDK Versions
Architect's Tech Stack
Architect's Tech Stack
Aug 20, 2021 · Fundamentals

Understanding Java String Length Limits: JVM Specification and Practical Constraints

This article explains the theoretical and practical limits of Java String length, detailing how strings are stored as char arrays, the impact of the JVM constant‑pool specification (u2 index limit of 65534), and how runtime concatenation can exceed compile‑time restrictions.

Constant PoolJVMJava
0 likes · 8 min read
Understanding Java String Length Limits: JVM Specification and Practical Constraints
Architecture Digest
Architecture Digest
Apr 20, 2021 · Backend Development

Understanding Java String Length Limits and JVM Constant‑Pool Restrictions

This article explains why Java strings have a theoretical maximum size of about 2^31‑1 characters at runtime, but literal strings defined in source code are limited to 65 534 characters due to JVM constant‑pool specifications, and demonstrates the limits with practical experiments.

BackendConstant PoolJVM
0 likes · 8 min read
Understanding Java String Length Limits and JVM Constant‑Pool Restrictions
Java Captain
Java Captain
Mar 3, 2021 · Fundamentals

Understanding the Length Limits of Java String: JVM Specification and Practical Limits

Java's String type has both theoretical and practical length limits: while the underlying char[] array can hold up to 2^31‑1 characters (~4 GB) due to int indexing, the JVM constant‑pool restricts literal strings to a maximum of 65 534 characters, as explained with code examples and spec excerpts.

Constant PoolJVMJava
0 likes · 8 min read
Understanding the Length Limits of Java String: JVM Specification and Practical Limits
Python Programming Learning Circle
Python Programming Learning Circle
Dec 12, 2020 · Fundamentals

Understanding Python Object Pooling, Integer Caching, and Interning Mechanisms

This article explains why identical integers and short strings may reference the same object in Python, how the small‑integer cache and string interning work, and how compilation units and constant pools affect object identity across interactive sessions and script files.

Compilation UnitConstant PoolObject Pooling
0 likes · 8 min read
Understanding Python Object Pooling, Integer Caching, and Interning Mechanisms
Selected Java Interview Questions
Selected Java Interview Questions
Nov 15, 2020 · Backend Development

Understanding Java String Length Limits and JVM Constant‑Pool Restrictions

This article explains how Java strings are stored, the theoretical 2^31‑1 character limit imposed by the underlying char[] array, and the practical 65534‑character limit enforced by the JVM constant‑pool specification, illustrated with code examples and a small experiment.

Constant PoolJVMJava
0 likes · 8 min read
Understanding Java String Length Limits and JVM Constant‑Pool Restrictions
Full-Stack Internet Architecture
Full-Stack Internet Architecture
Apr 18, 2020 · Backend Development

Understanding How new String Creates Objects and the Role of the String Constant Pool in Java

This article explains why the new String("xxx") expression may create one or two objects depending on the presence of the literal in the JVM's string constant pool, demonstrates the behavior with compiled bytecode and runtime examples, and clarifies common interview misconceptions about Java string object creation.

Constant PoolJVMJava
0 likes · 12 min read
Understanding How new String Creates Objects and the Role of the String Constant Pool in Java
Architecture Digest
Architecture Digest
Dec 11, 2019 · Fundamentals

Understanding Java String Concatenation, Constant Pool, and Bytecode Behavior

This article explains how Java handles String literals and concatenation, detailing the roles of the String constant pool, the effects of the '+' operator invoking StringBuilder.append, the placement of resulting strings in the heap versus the pool, and demonstrates these concepts through bytecode analysis and code examples.

Constant PoolJavaMemory Management
0 likes · 12 min read
Understanding Java String Concatenation, Constant Pool, and Bytecode Behavior
Java Captain
Java Captain
Dec 18, 2017 · Fundamentals

Understanding Java Constant Pool: Theory and Practice

This article explains the Java constant pool, distinguishing static and runtime pools, demonstrates string interning behavior with code examples, and shows how to inspect class files and memory settings to observe constant pool effects in the JVM.

Constant PoolJVMJava
0 likes · 9 min read
Understanding Java Constant Pool: Theory and Practice