Skip to content

Commit

Permalink
World.cs: seal and add IDisposable interface
Browse files Browse the repository at this point in the history
  • Loading branch information
notgiven688 committed Nov 27, 2024
1 parent d22fbc6 commit 6df9965
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Jitter2/World.Detect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

namespace Jitter2;

public partial class World
public sealed partial class World
{
private struct ConvexHullIntersection
{
Expand Down
2 changes: 1 addition & 1 deletion src/Jitter2/World.Step.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

namespace Jitter2;

public partial class World
public sealed partial class World
{
// Note: A SlimBag of the reference type 'Arbiter' does not introduce GC problems (not setting
// all elements to null when clearing) since the references for Arbiters are pooled anyway.
Expand Down
10 changes: 9 additions & 1 deletion src/Jitter2/World.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace Jitter2;
/// <summary>
/// Represents a simulation environment that holds and manages the state of all simulation objects.
/// </summary>
public partial class World
public sealed partial class World : IDisposable
{
public enum ThreadModelType
{
Expand Down Expand Up @@ -447,4 +447,12 @@ public RigidBody CreateRigidBody()

return body;
}

public void Dispose()
{
memContacts.Dispose();
memRigidBodies.Dispose();
memConstraints.Dispose();
memSmallConstraints.Dispose();
}
}

0 comments on commit 6df9965

Please sign in to comment.