heterodb / pg-strom

PG-Strom - Master development repository
http://heterodb.github.io/pg-strom/
Other
1.27k stars 163 forks source link

[bugfix] Fix the bug of dynamically allocating fallback buffer size a… #777

Closed QingMa-gp closed 2 weeks ago

QingMa-gp commented 1 month ago

…nd nrooms

The following two lines of code seem to be a typo. Based on experience, fallback_bufsz and fallback_nrooms should be multiplied by 2 first and then a constant is added, instead of multiplying by (2 + BLCKSZ) or (2 + 100). Otherwise, it will cause the growth rate of fallback_bufsz and fallback_nrooms to be too fast, leading to an OOM issue.

    while (pts->fallback_usage + sz > pts->fallback_bufsz)
    {
        pts->fallback_bufsz *= 2 + BLCKSZ;
        ...
    }
    while (pts->fallback_nitems >= pts->fallback_nrooms)
    {
        pts->fallback_nrooms *= 2 + 100;
        ...
    }
kaigai commented 2 weeks ago

Thanks for your report. It is an exactly a bug, and tends to allocate too much buffer than my expectation.