130 likes | 246 Vues
Learn how to optimize memory usage with effective buffer management strategies in Java to enhance performance and resource utilization. This guide provides insights into utilizing StringBuilder efficiently for better memory allocation.
E N D
Stack Heap str bira String@42e816 anotherStr String@42e816 bi bi String@3ecfff ra ra String@9ae764 thirdString bira String@7cdaf2
Stack Heap hello Hello string@a8fe24 same string@a8fe24
Stack Heap str1 Hello String@6e278a str2 String@6e278a
Stack Heap hel Hel string@6e278a hello Hello string@2fa8fc copy Hello string@a7b46e
Stack Heap declared Intern pool string@6e278a interned string@6e278a built Intern pool string@a7b46e
Stack Heap str1 Hello String@6e278a str2 Hello String@821a48
Stack Heap str 0 1 2 3 4 5 6 7 8 910 11 12 13 14 15 16 17 18 20 21 string@821a48
Stack Heap someCat (Cat members) Cat@6e278a
Stack Heap name: String@a272e8 someCat Cat@6e278a color: String@852fa4 Johny brown
Stack Heap name: String@a272e8 someCat Cat@6e278a color: String@852fa4 Johny brown
Stack Heap i 42 (4 bytes) ch A (2 bytes) result true (1 byte) obj Integer (4 bytes) 42 Integer@9ae764 str Hello String String@7cdaf2 bytes 1 2 3 [B@190d11 byte[]
Stack Heap i 0 (4 bytes) ch B (2 bytes) result Bye false (1 byte) String obj Integer (4 bytes) 42 null str Hello String String@9a787b bytes 1 0 3 [B@190d11 byte[]
Capacity • StringBuilder: • Length=9 • Capacity=15 неизползван буфер използван буфер (Length)