From 19d1d782b2c4f04d78ae4ba4ea44fb8071676500 Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Tue, 1 Feb 2022 04:54:54 +0700 Subject: [PATCH] Remove reference to Props in LocalActorRef, this have a huge memory impact when LocalActorRef is being cached. --- src/core/Akka/Actor/LocalActorRef.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/core/Akka/Actor/LocalActorRef.cs b/src/core/Akka/Actor/LocalActorRef.cs index 11e9f6cad9d..6b6b572acfc 100644 --- a/src/core/Akka/Actor/LocalActorRef.cs +++ b/src/core/Akka/Actor/LocalActorRef.cs @@ -22,7 +22,6 @@ namespace Akka.Actor public class LocalActorRef : ActorRefWithCell, ILocalRef { private readonly ActorSystemImpl _system; - private readonly Props _props; private readonly MessageDispatcher _dispatcher; private readonly IInternalActorRef _supervisor; private readonly ActorPath _path; @@ -57,7 +56,6 @@ public LocalActorRef(ActorSystemImpl system, Props props, MessageDispatcher disp IInternalActorRef supervisor, ActorPath path) { _system = system; - _props = props; _dispatcher = dispatcher; MailboxType = mailboxType; _supervisor = supervisor; @@ -74,7 +72,7 @@ public LocalActorRef(ActorSystemImpl system, Props props, MessageDispatcher disp * object from another thread as soon as we run init. */ // ReSharper disable once VirtualMemberCallInConstructor - _cell = NewActorCell(_system, this, _props, _dispatcher, + _cell = NewActorCell(_system, this, props, _dispatcher, _supervisor); // _cell needs to be assigned before Init is called. _cell.Init(true, MailboxType); } @@ -168,7 +166,7 @@ public override ActorPath Path /// /// The used to create this actor. /// - protected Props Props => _props; + protected Props Props => _cell.Props; /// /// The this actor will use to execute its message-processing.