OutOfMemoryError: GC Overhead Limit Exceeded
Question:
I am receiving a "java.lang.OutOfMemoryError: GC overhead limit exceeded" error in a program that creates several HashMap objects with small text entries. Is there a programmatic alternative to increasing the heap size or disabling the error check?
Answer:
Yes, several programmatic alternatives can address this issue:
Note that using the HashMap.clear() method will indeed clear the data stored in the HashMap, rendering it unusable for the intended purpose. Therefore, it is not a recommended solution.
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3