Closed Hamayama closed 5 years ago
Hmm. The patch is small and looks innocent. Please trying commenting various lines of the patch, e.g. GC_FREE(GC_MALLOC_ATOMIC_IGNORE_OFF_PAGE(1))
I made branches from mingw32test and tested on AppVeyor.
mingw32test2A 'comment out GC_MALLOC_ATOMIC_IGNORE_OFF_PAGE(1)' https://ci.appveyor.com/project/Hamayama/bdwgc/builds/22300382#L356 (NG)
mingw32test2B 'comment out GC_MALLOC_IGNORE_OFF_PAGE(2)' https://ci.appveyor.com/project/Hamayama/bdwgc/builds/22300886#L379 (NG)
mingw32test2C 'comment out GC_MALLOC_ATOMIC_IGNORE_OFF_PAGE(1) and GC_MALLOC_IGNORE_OFF_PAGE(2)' https://ci.appveyor.com/project/Hamayama/bdwgc/builds/22301447 (OK) https://ci.appveyor.com/project/Hamayama/bdwgc/builds/22301955 (OK) https://ci.appveyor.com/project/Hamayama/bdwgc/builds/22302644#L320 (NG)
There seems to be other causes ...
I can't reproduce this issue on my pc (Windows 8.1 (64bit), MSYS2/MinGW-w64 (32bit)). I can reproduce this issue on AppVeyor only.
Next, I will try to collect heap size data (e.g. min/max/mean) of gctest for some branches.
I think this issue is not a serious problem. So, I will do it at my own pace ...
So, I will do it at my own pace ...
Cool! Thank you
I think it is not a bug, just the tested condition should be relaxed slightly (of course, it would be good to understand why the condition is violated)
I found that GC_disable();
in run_one_test
in tests/test.c seems to affect all threads.
I commented out this and confirmed that total heap size decreases.
before: https://github.com/Hamayama/bdwgc/commit/aedc5df480ef7ffaae11e3eb3238d57942873c93
after: https://github.com/Hamayama/bdwgc/commit/a7b2fd502013a4ddd2b6ebe7a3ddde0771f4fb73
result:
https://drive.google.com/open?id=1H9HePh6yhJl62OnfJJ0f5wZK--is-Re4gqhHZ1v5hOg
( This is google spreadsheet. See AV32
and AV32 Fix
sheets. )
I see the root cause - in the multi-threaded case, one thread may do GC_disable and be suspended by OS scheduler (especially you can see it on a single or dual-core CPU like AppVeyor) while other threads may want to allocate a lot of memory. I'll make the fix - move GC_disable/enable testing to some other place when only a single client thread exists.
Good catch, thank you. Sometimes an innocent code turns out to be guilty.
I think the issue is fixed.
I tested master and OK. Thanks!
https://drive.google.com/open?id=1H9HePh6yhJl62OnfJJ0f5wZK--is-Re4gqhHZ1v5hOg
(AV32 Update
sheet)
I made a local branch (mingw32test) from master and tested on AppVeyor. https://github.com/Hamayama/bdwgc/commit/199f150a26ca24d1871555ac808e1d542aa63c76 https://ci.appveyor.com/project/Hamayama/bdwgc/builds/22297190
gctest fails infrequently (Unexpected heap growth) with Mingw 32-bit. https://ci.appveyor.com/project/Hamayama/bdwgc/builds/22297190#L508
I tried 'git bisect start 9483d5b c7837f8' and found the following commit.
It seems to allocate heap memory though I don't know the size ...