Cách khắc phục lỗi OutOfMemory trong Eclipse bằng cách tăng Heap Memory / PermGen Space
2 phút đọc25/08/2025
Chris Pham
Technical Writer
0 lượt xem
0 lượt xem
Reading Time: 2minutes
Lỗi OutOfMemory trong Eclipse thường xảy ra khi bạn làm việc với những dự án lớn. Đôi khi lỗi này xuất phát từ việc thiếu PermGen space (với Java dưới phiên bản 8), và đôi khi là do Eclipse hết heap memory.
Cách khắc phục lỗi OutOfMemory trong Eclipse
Bạn có thể tăng giới hạn bộ nhớ cho Eclipse bằng cách cung cấp thêm PermGen space và heap memory. Những cấu hình này được thiết lập trong file eclipse.ini. Bạn có thể tìm vị trí của file eclipse.ini trên hệ điều hành Mac OS X như hình minh họa dưới đây.
Trên Windows, bạn sẽ tìm thấy file eclipse.ini nằm cùng thư mục với file eclipse.exe
Sau khi bạn đã xác định được vị trí file eclipse.ini, hãy mở nó bằng trình soạn thảo văn bản mà bạn yêu thích.
Tăng Heap Space cho Eclipse
Bạn có thể tăng kích thước heap tối đa bằng cách chỉnh sửa giá trị -Xmx.
Ví dụ, đoạn cấu hình dưới đây sẽ tăng dung lượng heap của Eclipse lên 2 GB.
-Xmx2048m
Tăng Permgen Space trong Eclipse
Nếu bạn đang sử dụng Java phiên bản thấp hơn Java 8, thì có thể bạn sẽ gặp lỗi OutOfMemoryError: Permgen space, bạn chỉ cần tăng dung lượng bộ nhớ permanent generation mà Eclipse được phép sử dụng. Dưới đây là cấu hình để tăng Permgen space lên 512 MB trong file eclipse.ini.
-XX:MaxPermSize=512M
Về tác giả
Chris PhamTechnical Writer
I have over 5 years of experience writing technical documentation for tech products, making them accessible and user-friendly. My focus is always on providing clear and precise information.
@#@
Tôi đã có hơn 5 năm kinh nghiệm viết tài liệu kỹ thuật cho các sản phẩm công nghệ, giúp người dùng dễ dàng tiếp cận và sử dụng. Tôi luôn tập trung vào việc cung cấp thông tin chính xác và dễ hiểu.
Cập nhật thông tin mới nhấtNhận các thông tin mới nhất về mối đe dọa, báo cáo an ninh mạng từ CyStack về hòm thư điện tử của bạn
Thảo luận (0)
Đăng nhập để thảo luận
Bài viết liên quan
{"success":true,"head":"<title>Cách khắc phục lỗi OutOfMemory trong Eclipse bằng cách tăng Heap Memory / PermGen Space - CyStack Tutorial</title>\n<meta name=\"description\" content=\"Lỗi OutOfMemory trong Eclipse thường xảy ra khi bạn làm việc với những dự án lớn. Đôi khi lỗi này xuất phát từ việc thiếu PermGen space (với Java dưới phiên\"/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-video-preview:-1, max-image-preview:large\"/>\n<link rel=\"canonical\" href=\"https://blog.cystack.org/tutorial/2025/08/25/khac-phuc-loi-outofmemory-trong-eclipse/\" />\n<meta property=\"og:locale\" content=\"en_US\" />\n<meta property=\"og:type\" content=\"article\" />\n<meta property=\"og:title\" content=\"Cách khắc phục lỗi OutOfMemory trong Eclipse bằng cách tăng Heap Memory / PermGen Space - CyStack Tutorial\" />\n<meta property=\"og:description\" content=\"Lỗi OutOfMemory trong Eclipse thường xảy ra khi bạn làm việc với những dự án lớn. Đôi khi lỗi này xuất phát từ việc thiếu PermGen space (với Java dưới phiên\" />\n<meta property=\"og:url\" content=\"https://blog.cystack.org/tutorial/2025/08/25/khac-phuc-loi-outofmemory-trong-eclipse/\" />\n<meta property=\"og:site_name\" content=\"CyStack Tutorial\" />\n<meta property=\"article:tag\" content=\"vi\" />\n<meta property=\"article:section\" content=\"Chuyên gia\" />\n<meta property=\"og:image\" content=\"https://s2.cystack.net/tutorial/25164122/khac-phuc-loi-outofmemory-trong-eclipse.jpg\" />\n<meta property=\"og:image:secure_url\" content=\"https://s2.cystack.net/tutorial/25164122/khac-phuc-loi-outofmemory-trong-eclipse.jpg\" />\n<meta property=\"og:image:width\" content=\"1200\" />\n<meta property=\"og:image:height\" content=\"630\" />\n<meta property=\"og:image:alt\" content=\"khắc phục lỗi OutOfMemory trong Eclipse\" />\n<meta property=\"og:image:type\" content=\"image/jpeg\" />\n<meta property=\"article:published_time\" content=\"2025-08-25T16:41:47+07:00\" />\n<meta name=\"twitter:card\" content=\"summary_large_image\" />\n<meta name=\"twitter:title\" content=\"Cách khắc phục lỗi OutOfMemory trong Eclipse bằng cách tăng Heap Memory / PermGen Space - CyStack Tutorial\" />\n<meta name=\"twitter:description\" content=\"Lỗi OutOfMemory trong Eclipse thường xảy ra khi bạn làm việc với những dự án lớn. Đôi khi lỗi này xuất phát từ việc thiếu PermGen space (với Java dưới phiên\" />\n<meta name=\"twitter:image\" content=\"https://s2.cystack.net/tutorial/25164122/khac-phuc-loi-outofmemory-trong-eclipse.jpg\" />\n<meta name=\"twitter:label1\" content=\"Written by\" />\n<meta name=\"twitter:data1\" content=\"Chris Pham\" />\n<meta name=\"twitter:label2\" content=\"Time to read\" />\n<meta name=\"twitter:data2\" content=\"1 minute\" />\n<script type=\"application/ld+json\" class=\"rank-math-schema\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https://blog.cystack.org/tutorial/#person\",\"name\":\"CyStack Tutorial\"},{\"@type\":\"WebSite\",\"@id\":\"https://blog.cystack.org/tutorial/#website\",\"url\":\"https://blog.cystack.org/tutorial\",\"name\":\"CyStack Tutorial\",\"publisher\":{\"@id\":\"https://blog.cystack.org/tutorial/#person\"},\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https://s2.cystack.net/tutorial/25164122/khac-phuc-loi-outofmemory-trong-eclipse.jpg\",\"url\":\"https://s2.cystack.net/tutorial/25164122/khac-phuc-loi-outofmemory-trong-eclipse.jpg\",\"width\":\"1200\",\"height\":\"630\",\"caption\":\"kh\\u1eafc ph\\u1ee5c l\\u1ed7i OutOfMemory trong Eclipse\",\"inLanguage\":\"en-US\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://blog.cystack.org/tutorial/2025/08/25/khac-phuc-loi-outofmemory-trong-eclipse/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":\"1\",\"item\":{\"@id\":\"https://blog.cystack.org/tutorial\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"position\":\"2\",\"item\":{\"@id\":\"https://blog.cystack.org/tutorial/category/chuyen-gia/\",\"name\":\"Chuy\\u00ean gia\"}},{\"@type\":\"ListItem\",\"position\":\"3\",\"item\":{\"@id\":\"https://blog.cystack.org/tutorial/2025/08/25/khac-phuc-loi-outofmemory-trong-eclipse/\",\"name\":\"C\\u00e1ch kh\\u1eafc ph\\u1ee5c l\\u1ed7i OutOfMemory trong Eclipse b\\u1eb1ng c\\u00e1ch t\\u0103ng Heap Memory / PermGen Space\"}}]},{\"@type\":\"WebPage\",\"@id\":\"https://blog.cystack.org/tutorial/2025/08/25/khac-phuc-loi-outofmemory-trong-eclipse/#webpage\",\"url\":\"https://blog.cystack.org/tutorial/2025/08/25/khac-phuc-loi-outofmemory-trong-eclipse/\",\"name\":\"C\\u00e1ch kh\\u1eafc ph\\u1ee5c l\\u1ed7i OutOfMemory trong Eclipse b\\u1eb1ng c\\u00e1ch t\\u0103ng Heap Memory / PermGen Space - CyStack Tutorial\",\"datePublished\":\"2025-08-25T16:41:47+07:00\",\"dateModified\":\"2025-08-25T16:41:47+07:00\",\"isPartOf\":{\"@id\":\"https://blog.cystack.org/tutorial/#website\"},\"primaryImageOfPage\":{\"@id\":\"https://s2.cystack.net/tutorial/25164122/khac-phuc-loi-outofmemory-trong-eclipse.jpg\"},\"inLanguage\":\"en-US\",\"breadcrumb\":{\"@id\":\"https://blog.cystack.org/tutorial/2025/08/25/khac-phuc-loi-outofmemory-trong-eclipse/#breadcrumb\"}},{\"@type\":\"Person\",\"@id\":\"https://blog.cystack.org/tutorial/author/codeweaver/\",\"name\":\"Chris Pham\",\"url\":\"https://blog.cystack.org/tutorial/author/codeweaver/\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https://secure.gravatar.com/avatar/7a3584c941fa360ac061b2a8f15684ced7b92daa1f09481be135a684d989e9b9?s=96&d=mm&r=g\",\"url\":\"https://secure.gravatar.com/avatar/7a3584c941fa360ac061b2a8f15684ced7b92daa1f09481be135a684d989e9b9?s=96&d=mm&r=g\",\"caption\":\"Chris Pham\",\"inLanguage\":\"en-US\"}},{\"@type\":\"BlogPosting\",\"headline\":\"C\\u00e1ch kh\\u1eafc ph\\u1ee5c l\\u1ed7i OutOfMemory trong Eclipse b\\u1eb1ng c\\u00e1ch t\\u0103ng Heap Memory / PermGen Space - CyStack Tutorial\",\"keywords\":\"l\\u1ed7i OutOfMemory,kh\\u1eafc ph\\u1ee5c l\\u1ed7i OutOfMemory trong Eclipse\",\"datePublished\":\"2025-08-25T16:41:47+07:00\",\"dateModified\":\"2025-08-25T16:41:47+07:00\",\"articleSection\":\"Chuy\\u00ean gia\",\"author\":{\"@id\":\"https://blog.cystack.org/tutorial/author/codeweaver/\",\"name\":\"Chris Pham\"},\"publisher\":{\"@id\":\"https://blog.cystack.org/tutorial/#person\"},\"description\":\"L\\u1ed7i OutOfMemory trong Eclipse th\\u01b0\\u1eddng x\\u1ea3y ra khi b\\u1ea1n l\\u00e0m vi\\u1ec7c v\\u1edbi nh\\u1eefng d\\u1ef1 \\u00e1n l\\u1edbn. \\u0110\\u00f4i khi l\\u1ed7i n\\u00e0y xu\\u1ea5t ph\\u00e1t t\\u1eeb vi\\u1ec7c thi\\u1ebfu PermGen space (v\\u1edbi Java d\\u01b0\\u1edbi phi\\u00ean\",\"name\":\"C\\u00e1ch kh\\u1eafc ph\\u1ee5c l\\u1ed7i OutOfMemory trong Eclipse b\\u1eb1ng c\\u00e1ch t\\u0103ng Heap Memory / PermGen Space - CyStack Tutorial\",\"@id\":\"https://blog.cystack.org/tutorial/2025/08/25/khac-phuc-loi-outofmemory-trong-eclipse/#richSnippet\",\"isPartOf\":{\"@id\":\"https://blog.cystack.org/tutorial/2025/08/25/khac-phuc-loi-outofmemory-trong-eclipse/#webpage\"},\"image\":{\"@id\":\"https://s2.cystack.net/tutorial/25164122/khac-phuc-loi-outofmemory-trong-eclipse.jpg\"},\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https://blog.cystack.org/tutorial/2025/08/25/khac-phuc-loi-outofmemory-trong-eclipse/#webpage\"}}]}</script>\n"}