About 255,000 results
Open links in new tab
  1. Storage of String in Java - GeeksforGeeks

    Jan 8, 2024 · Stack space contains specific values that are short-lived whereas Heap space is by Java Runtime to allocate memory to objects and JRE classes. In Java, strings are stored in the heap area.

  2. java - How is memory allocated for a string? - Stack Overflow

    Jul 10, 2012 · In Java, String is an immutable Object, so the "size" of the String has to be known at time of allocation. It'll end up allocated in a shared object pool if it's "static" (e.g. a String litteral, like "Hey, I'm a String litteral!"), or on the heap if it's constructed using new String(...).

  3. How much memory does a string use in Java 8? - Stack Overflow

    Jul 3, 2015 · I read a lot about memory allocation for Strings lately and can't find any details if things are the same with Java 8. How much memory space would a String like "Alexandru Tanasescu" use in Java 8? I use the 64bit version.

  4. Memory allocation in Java Strings - Stack Overflow

    Feb 11, 2011 · If String x = "abc"; String y = "abc"; What is the memory allocation for x and y ?

  5. Guide to Java String Pool - Baeldung

    Mar 26, 2025 · Learn how the JVM optimizes the amount of memory allocated to String storage in the Java String Pool.

  6. String Memory Allocation In Java: Tips for Efficiency

    Sep 25, 2023 · Explore the intricacies of string memory allocation in Java, optimize memory usage, and boost application performance with best practices.

  7. Memory Allocation of Strings in Java | by Arpana Chilli | Medium

    Jan 9, 2024 · In Java, strings are stored in the memory as objects of the class String. When memory is allocated for any Java program, JVM (Java virtual machine) divides allocated …

  8. String Literals in Java: Memory Storage Explained

    Learn how and where string literals are stored in Java memory. Explore the intricacies of Java memory management related to string handling.

  9. String Memory in Java: Heap, Pool & Performance Tricks

    Unlike primitive types, Java Strings have unique memory allocation mechanisms, including the String Pool and the Heap, which impact performance and optimization. In this blog, we’ll explore:

  10. Understanding Memory Usage of Strings in Java

    Understanding how Java manages memory for Strings is crucial for optimizing application performance and memory usage. This guide explores the memory allocation for Strings, key characteristics, and best practices for efficient memory management.

Refresh