'Why is winbgi function settextstyle() occupying memory on the heap?

I am making a snake game in C using winbgi library. I have a problem with function settextstyle(). Every call of function adds memory to the heap (about 50kb). I have to use this function in loop, so at some point the heap starts to overflow. Is there a way to release memory occupied by this function? Or some other way to change the size of the text in winbgi?

while(1)
{
    settextstyle(DEFAULT_FONT, HORIZ_DIR, 4)
    outtext(...)
    settextstyle(DEFAULT_FONT, HORIZ_DIR, 2)
    outtext(...)
}


Solution 1:[1]

Pull the latest winbgi sources from here.

There was a bug (missing call to DeleteObject() after SelectObject() to set a new font in set_font()) within text.cxx which the code linked fixes.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 alk