8245867: Logger/bundleLeak/BundleTest.java fails due to "OutOfMemoryError: Java heap space"
Daniel Fuchs
daniel.fuchs at oracle.com
Fri May 29 09:01:35 UTC 2020
Hi David,
Thanks for the feedback!
On 29/05/2020 00:36, David Holmes wrote:
> This seems to be assuming that the GC will clear all SoftReferences when
> it needs to clear any SoftReference. I don't think that is at all
> guaranteed. In theory your memory eating loop could be satisfied by
> clearing only the SoftReference added in the previous iteration of the
> loop.
I was wondering about that.
> I would have expected the fix here to be simply to clear memory ie:
>
> } catch (OutOfMemoryError oome) {
> stop = true;
> memory = null;
> System.gc();
> }
Do you think this would be more reliable?
It was my first thought as well - and that was the
first thing I tested, and it seemed to work as well.
If you think it's a better solution I can revert to that.
My rationale for using SoftReference is that they
then could be cleared any time by the GC, and
possibly avoid unexpected OOME elsewhere in the test
machinery.
best regards,
-- daniel
More information about the core-libs-dev
mailing list