Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.


#425 Cygwin: Warning: can't allocate color black

Curt Mills
Curt Mills

With a refresh tag in a .geo file, one user is getting
the above listed warning. Looking at the code a bit we
appear to be XAllocColor() in several places but not
ever calling XFreeColors(). A bit of investigation
should reveal whether we should free them and when/how.

An interesting related link:

I suspect what I'm going to want to do is keep track of
which ones
we allocate and free the colors right after we either
draw the pixel
or after we draw each file. I'm just hoping it won't
be too slow
once we add that.

Here's XV's code for color allocation and free'ing,
which may be useful to us:


  • Curt Mills
    Curt Mills

    Logged In: YES

    Another user had the "can't allocate color black" problem,
    both when running directly under Cygwin, and when running on
    a Linux box elsewhere, displaying on the Windows box (using
    a commercial X-server (XWin32 from StarNet Communications).
    By forcing the X-server to 24-bit, the problem appears to
    have disappeared.