bevy/crates
Brian Reavis 724fe49c73
Fix TextureCache memory leak and add is_empty() method (#14480)
# 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)
2024-07-27 13:16:27 +00:00
..
bevy_a11y Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_animation Fix repeated animation transition bug (#14411) 2024-07-22 19:17:46 +00:00
bevy_app Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_asset Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_audio Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_color Fix hue mixing for Lcha and Oklcha (#14468) 2024-07-25 19:44:18 +00:00
bevy_core Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_core_pipeline Handle 0 height in prepare_bloom_textures (#14423) 2024-07-26 21:53:36 +00:00
bevy_derive Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_dev_tools Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_diagnostic Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_dylib Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_dynamic_plugin Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_ecs Add intradoc links for observer triggers (#14458) 2024-07-24 18:41:23 +00:00
bevy_encase_derive Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_gilrs Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_gizmos Don't ignore draw errors (#13240) 2024-07-22 19:22:30 +00:00
bevy_gltf Fix bevy_gltf PBR features not enabling corresponding bevy_pbr flags (#14486) 2024-07-26 17:11:38 +00:00
bevy_hierarchy Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_input feature: Derive Hash for KeyboardInput. (#14263) 2024-07-23 12:29:15 +00:00
bevy_internal Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_log Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_macro_utils Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_math Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_mikktspace Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_pbr Fixup Msaa docs. (#14442) 2024-07-22 21:37:25 +00:00
bevy_picking Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_ptr ptr: allow Ptr and PtrMut construction for references to values of ?Sized types (#14479) 2024-07-25 23:14:16 +00:00
bevy_reflect Dedicated Reflect implementation for Set-like things (#13014) 2024-07-24 19:43:26 +00:00
bevy_render Fix TextureCache memory leak and add is_empty() method (#14480) 2024-07-27 13:16:27 +00:00
bevy_scene Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_sprite Don’t prepare 2D view bind groups for 3D cameras (#14481) 2024-07-25 20:37:54 +00:00
bevy_state Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_tasks Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_text Remove #[cfg] from the From impls of TextSection (#14439) 2024-07-26 17:11:12 +00:00
bevy_time Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_transform Conversions for Isometry3d ⟷ Transform/GlobalTransform (#14478) 2024-07-25 20:23:32 +00:00
bevy_ui Add BorderRadius field to ImageBundle (#14457) 2024-07-24 18:41:26 +00:00
bevy_utils Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_window Remove manual --cfg docsrs (#14376) 2024-07-22 18:58:04 +00:00
bevy_winit Fix bevy_winit not building with serialize feature (#14469) 2024-07-26 22:05:36 +00:00