diff --git a/src/Textures.cpp b/src/Textures.cpp index 5af07062..5ed969ff 100644 --- a/src/Textures.cpp +++ b/src/Textures.cpp @@ -522,6 +522,16 @@ void TextureCache::destroy() void TextureCache::_checkCacheSize() { +#ifdef VC + if (m_textures.size() > 15000) { + CachedTexture& piTex = m_textures.back(); + m_cachedBytes -= piTex.textureBytes; + glDeleteTextures(1, &piTex.glName); + m_lruTextureLocations.erase(piTex.crc); + m_textures.pop_back(); + } +#endif + if (m_cachedBytes <= m_maxBytes) return;