bevy/crates
Brian Reavis 680c994100
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-08-02 19:24:54 +02:00
..
bevy_a11y Release 0.14.0 version bump (#14126) 2024-07-03 18:22:10 -07:00
bevy_animation Fix single keyframe animations. (#14344) 2024-08-02 19:24:54 +02:00
bevy_app Release 0.14.0 version bump (#14126) 2024-07-03 18:22:10 -07:00
bevy_asset EmptyPathStream is only used in android/wasm32 (#14200) 2024-08-02 18:58:30 +02:00
bevy_audio Release 0.14.0 version bump (#14126) 2024-07-03 18:22:10 -07:00
bevy_color Release 0.14.0 version bump (#14126) 2024-07-03 18:22:10 -07:00
bevy_core Release 0.14.0 version bump (#14126) 2024-07-03 18:22:10 -07:00
bevy_core_pipeline Handle 0 height in prepare_bloom_textures (#14423) 2024-08-02 19:24:54 +02:00
bevy_derive Release 0.14.0 version bump (#14126) 2024-07-03 18:22:10 -07:00
bevy_dev_tools Release 0.14.0 version bump (#14126) 2024-07-03 18:22:10 -07:00
bevy_diagnostic Release 0.14.0 version bump (#14126) 2024-07-03 18:22:10 -07:00
bevy_dylib Release 0.14.0 version bump (#14126) 2024-07-03 18:22:10 -07:00
bevy_dynamic_plugin Release 0.14.0 version bump (#14126) 2024-07-03 18:22:10 -07:00
bevy_ecs Add some missing reflect attributes (#14259) 2024-08-02 19:20:44 +02:00
bevy_encase_derive Release 0.14.0 version bump (#14126) 2024-07-03 18:22:10 -07:00
bevy_gilrs Release 0.14.0 version bump (#14126) 2024-07-03 18:22:10 -07:00
bevy_gizmos Release 0.14.0 version bump (#14126) 2024-07-03 18:22:10 -07:00
bevy_gltf Fix bevy_gltf PBR features not enabling corresponding bevy_pbr flags (#14486) 2024-08-02 19:24:54 +02:00
bevy_hierarchy Release 0.14.0 version bump (#14126) 2024-07-03 18:22:10 -07:00
bevy_input bevy_input: allow use without bevy_reflect (#14167) 2024-08-02 19:11:13 +02:00
bevy_internal Release 0.14.0 version bump (#14126) 2024-07-03 18:22:10 -07:00
bevy_log Release 0.14.0 version bump (#14126) 2024-07-03 18:22:10 -07:00
bevy_macro_utils Release 0.14.0 version bump (#14126) 2024-07-03 18:22:10 -07:00
bevy_math Fix swapped docs for Rot2::rotation_to/from_y (#14307) 2024-08-02 19:15:56 +02:00
bevy_mikktspace Release 0.14.0 version bump (#14126) 2024-07-03 18:22:10 -07:00
bevy_pbr Fix incorrect function calls to hsv_to_rgb in render debug code. (#14260) 2024-08-02 19:19:53 +02:00
bevy_ptr Release 0.14.0 version bump (#14126) 2024-07-03 18:22:10 -07:00
bevy_reflect Release 0.14.0 version bump (#14126) 2024-07-03 18:22:10 -07:00
bevy_render Fix TextureCache memory leak and add is_empty() method (#14480) 2024-08-02 19:24:54 +02:00
bevy_scene Release 0.14.0 version bump (#14126) 2024-07-03 18:22:10 -07:00
bevy_sprite Release 0.14.0 version bump (#14126) 2024-07-03 18:22:10 -07:00
bevy_state Make initial StateTransition run before PreStartup (#14208) 2024-08-02 19:17:57 +02:00
bevy_tasks Release 0.14.0 version bump (#14126) 2024-07-03 18:22:10 -07:00
bevy_text Release 0.14.0 version bump (#14126) 2024-07-03 18:22:10 -07:00
bevy_time Release 0.14.0 version bump (#14126) 2024-07-03 18:22:10 -07:00
bevy_transform Optimize unnecessary normalizations for Transform::local_{xyz} (#14171) 2024-08-02 18:58:31 +02:00
bevy_ui Add some missing reflect attributes (#14259) 2024-08-02 19:20:44 +02:00
bevy_utils Release 0.14.0 version bump (#14126) 2024-07-03 18:22:10 -07:00
bevy_window Fix bevy_window failing with serialize feature (#14298) 2024-08-02 19:18:25 +02:00
bevy_winit Fix bevy_winit not building with serialize feature (#14469) 2024-08-02 19:24:54 +02:00