-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix memory leak in dynamic ECS example (#11461)
# Objective - Fix a memory leak in the dynamic ECS example mentioned in #11459 ## Solution - Rather than allocate the memory manually instead store a collection of `Vec` that will be dropped after it is used. --- I must have misinterpreted `OwningPtr`s semantics when initially writing this example. I believe we should be able to provide better APIs here for inserting dynamic components that don't require the user to wrangle so much unsafety. We have no other examples using `insert_by_ids` and our only tests show it being used for 1 or 2 values with nested calls to `OwningPtr::make` despite the function taking an iterator. Rust's type system is quite restrictive here but we could at least let `OwningPtr::new` take non u8 `NonNull`. I also agree with #11459 that we should generally be trying to simplify and clarify this example.
- Loading branch information
1 parent
7d69d31
commit f8191be
Showing
1 changed file
with
39 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters