Metaspace

๋ฐฑ๊ธฐ์„  ๋‹˜์˜ <๋” ์ž๋ฐ”, Java 8>๋ฅผ ๋ณด๊ณ  ๊ณต๋ถ€ํ•œ ๋‚ด์šฉ์„ ๊ธฐ๋กํ•ฉ๋‹ˆ๋‹ค.

1. java8 ์ด์ „, PermGen

  • JVM ์˜ ํž™ ๋ฉ”๋ชจ๋ฆฌ ์˜์—ญ์—๋Š” ์›๋ž˜ Eden generation, Old generation, Permanent generation ๋ฉ”๋ชจ๋ฆฌ ์˜์—ญ์ด ์กด์žฌํ–ˆ์—ˆ๋‹ค.

  • PermGen ์€ Permanent Generation ์˜ ์•ฝ์ž๋กœ, ํด๋ž˜์Šค์˜ ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ๋ฅผ ๋ชจ์œผ๋Š” ๊ณณ์ด๋‹ค.

  • heap ์˜์—ญ์— ์†ํ•˜๋ฉฐ,

  • ๊ธฐ๋ณธ๊ฐ’์œผ๋กœ ์ œํ•œ๋œ (๊ณ ์ •๋œ) ํฌ๊ธฐ๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ๋‹ค.

  • ๋™์ ์œผ๋กœ ํด๋ž˜์Šค๋ฅผ ๋งŽ์ด ์ƒ์„ฑํ•˜๊ฑฐ๋‚˜ ๋„ˆ๋ฌด ๋งŽ์€ ํด๋ž˜์Šค๊ฐ€ ์ƒ์„ฑ๋˜๋ฉด PermGen ์˜์—ญ์ด ๊ฝ‰์ฐจ์„œ OutofMemory Exception ์ด ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ๋‹ค.

    • ์ด๋•Œ๋Š” ํด๋ž˜์Šค๋ฅผ ๊ณ„์† ์ƒ์„ฑํ•˜๋Š” ๊ฒƒ์ด ๋ฌธ์ œ์ด๋ฏ€๋กœ, ์›์ธ์ด ๋˜๋Š” ์ชฝ ์ฝ”๋“œ๋ฅผ ์ฐพ์•„ ๊ฐœ์„ ํ•˜๋Š” ์ˆ˜ ๋ฐ–์— ์—†๋‹ค.

  • PermGen ์ดˆ๊ธฐ ์‚ฌ์ด์ฆˆ ์„ค์ • : -XX:PermSize=N

  • PermGen ์ตœ๋Œ€ ์‚ฌ์ด์ฆˆ ์„ค์ • : -XX:MaxPermSize=N

2. java8 ์ดํ›„, Metaspace

  • java8 ์ดํ›„๋กœ๋Š” PermGen ๋ฉ”๋ชจ์ด ์˜์—ญ์ด ์‚ฌ๋ผ์ง€๊ณ , metaspace ๋ผ๋Š” ์˜์—ญ์ด ์ƒˆ๋กœ ์ƒ๊ฒผ๋‹ค.

  • ์—ญ์‹œ ํด๋ž˜์Šค์˜ ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ๋ฅผ ๋‹ด๋Š” ๊ณณ์œผ๋กœ

  • Heap ์˜์—ญ์ด ์•„๋‹ˆ๋ผ Native memory ์˜์—ญ์— ์กด์žฌํ•œ๋‹ค.

  • ์ž๋ฐ” 8๋ถ€ํ„ฐ๋Š” PermGen ๊ด€๋ จ java ์˜ต์…˜์€ ๋ฌด์‹œ๋œ๋‹ค.

  • Metaspace ์ดˆ๊ธฐ ์‚ฌ์ด์ฆˆ ์„ค์ • : -XX:MetaspaceSize=N

  • Metaspace ์ตœ๋Œ€ ์‚ฌ์ด์ฆˆ ์„ค์ • : -XX:MaxMetaspaceSize=N

3. ์ฐธ๊ณ 

  • http://mail.openjdk.java.net/pipermail/hotspot-dev/2012-September/006679.html

  • https://m.post.naver.com/viewer/postView.nhn?volumeNo=23726161&memberNo=3673

    3075

  • https://m.post.naver.com/viewer/postView.nhn?volumeNo=24042502&memberNo=3673

    3075

  • https://dzone.com/articles/java-8-permgen-metaspace

Last updated