mirror of
https://github.com/bevyengine/bevy
synced 2025-01-04 09:18:54 +00:00
724fe49c73
# Objective Fix a memory leak in `TextureCache` caused by the internal HashMap never having unused entries cleared. This isn't a giant memory leak, given the unused entries are simply empty vectors. Though, if someone goes and resizes a window a bunch, it can lead to hundreds/thousands of TextureDescriptor keys adding up in the hashmap – which isn't ideal. ## Solution - Only retain hashmap entries that still have textures. - I also added an `is_empty()` method to `TextureCache`, which is useful for 3rd-party higher-level caches that might have individual caches by view entity or texture type, for example. ## Testing - Verified the examples still work (this is a trivial change) |
||
---|---|---|
.. | ||
basis.rs | ||
compressed_image_saver.rs | ||
dds.rs | ||
exr_texture_loader.rs | ||
fallback_image.rs | ||
hdr_texture_loader.rs | ||
image.rs | ||
image_loader.rs | ||
image_texture_conversion.rs | ||
ktx2.rs | ||
mod.rs | ||
texture_attachment.rs | ||
texture_cache.rs |