Skip to content

Commit

Permalink
Patch memory leak in Archetype::grow(). (#569)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ratysz authored Sep 25, 2020
1 parent f7c8882 commit 3abfcad
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions crates/bevy_ecs/hecs/src/archetype.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,13 @@ impl Archetype {
new_data.as_ptr().add(new_off),
ty.layout.size() * old_count,
);
dealloc(
(*self.data.get()).as_ptr().cast(),
Layout::from_size_align_unchecked(
old_data_size,
self.types.first().map_or(1, |x| x.layout.align()),
),
);
}
}

Expand Down

0 comments on commit 3abfcad

Please sign in to comment.