Why my game crashes when i change input mapping context?

We have two view mode our my game:
1-Perspective
2-TopView
moving camera will be different in each mode so we decide to change between two input mapping contexts:
1-CameraPerspective_IMC
2-CameraTopView_IMC

we did it though this function:

void AVehicleController::EnableCameraTopViewEnhancedInput(bool bEnable)
{
	if (UEnhancedInputLocalPlayerSubsystem* Subsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(this->GetLocalPlayer()))
	{
		if (InputComponent != nullptr)
		{
			if (!EnhancedInputManager)
			{
				EnhancedInputManager = NewObject<UNasirEnhancedInputManager>();
			}
			if (!EnhancedInputManager)
			{
				UE_LOG(LogNasir, Error, TEXT("EnhancedInputManager Is Null"));
			}
			else
			{
				{
					if (bEnable)
					{
						Subsystem->RemoveMappingContext(EnhancedInputManager->CameraPerspective_IMC);
						Subsystem->AddMappingContext(EnhancedInputManager->CameraTopView_IMC, 0);
					}
					else
					{
						Subsystem->RemoveMappingContext(EnhancedInputManager->CameraTopView_IMC);;
						Subsystem->AddMappingContext(EnhancedInputManager->CameraPerspective_IMC, 0);
					}
				}
			}
		}
	}
}

it only works well at the first 50-60 second and after that changing the IMC will cause this crash:

Fatal error: [File:D:\build\++UE5\Sync\Engine\Source\Runtime\Core\Private\GenericPlatform\GenericPlatformMemory.cpp] [Line: 241] Ran out of memory allocating 54597521664 bytes with alignment 8. Last error msg: The paging file is too small for this operation to complete..

UnrealEditor_Core!<lambda_2f7b765a738be9e3beac65d9eaf9a7a2>::operator()() [D:\build\++UE5\Sync\Engine\Source\Runtime\Core\Private\GenericPlatform\GenericPlatformMemory.cpp:242]
UnrealEditor_Core!FGenericPlatformMemory::OnOutOfMemory() [D:\build\++UE5\Sync\Engine\Source\Runtime\Core\Private\GenericPlatform\GenericPlatformMemory.cpp:244]
UnrealEditor_Core!FMallocMimalloc::OutOfMemory() [D:\build\++UE5\Sync\Engine\Source\Runtime\Core\Public\HAL\MallocMimalloc.h:52]
UnrealEditor_Core!FMallocMimalloc::Realloc() [D:\build\++UE5\Sync\Engine\Source\Runtime\Core\Private\HAL\MallocMimalloc.cpp:136]
UnrealEditor_Core!FMemory::Realloc() [D:\build\++UE5\Sync\Engine\Source\Runtime\Core\Public\HAL\FMemory.inl:56]
UnrealEditor_EnhancedInput!TArray<FEnhancedActionKeyMapping,TSizedDefaultAllocator<32> >::ResizeTo() [D:\build\++UE5\Sync\Engine\Source\Runtime\Core\Public\Containers\Array.h:2964]
UnrealEditor_EnhancedInput!IEnhancedInputSubsystemInterface::ReorderMappings() [D:\build\++UE5\Sync\Engine\Plugins\EnhancedInput\Source\EnhancedInput\Private\EnhancedInputSubsystemInterface.cpp:595]
UnrealEditor_EnhancedInput!IEnhancedInputSubsystemInterface::RebuildControlMappings() [D:\build\++UE5\Sync\Engine\Plugins\EnhancedInput\Source\EnhancedInput\Private\EnhancedInputSubsystemInterface.cpp:711]
UnrealEditor_EnhancedInput!UE::Core::Private::Function::TFunctionRefCaller<<lambda_80f7255f2569af4c537be861177728a1>,void __cdecl(IEnhancedInputSubsystemInterface *)>::Call() [D:\build\++UE5\Sync\Engine\Source\Runtime\Core\Public\Templates\Function.h:474]
UnrealEditor_EnhancedInput!UEnhancedInputLibrary::ForEachSubsystem() [D:\build\++UE5\Sync\Engine\Plugins\EnhancedInput\Source\EnhancedInput\Private\EnhancedInputLibrary.cpp:28]
UnrealEditor_EnhancedInput!FEnhancedInputModule::Tick() [D:\build\++UE5\Sync\Engine\Plugins\EnhancedInput\Source\EnhancedInput\Private\EnhancedInputModule.cpp:311]
UnrealEditor_Engine!FTickableGameObject::TickObjects() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\Tickable.cpp:153]
UnrealEditor_UnrealEd!UEditorEngine::Tick() [D:\build\++UE5\Sync\Engine\Source\Editor\UnrealEd\Private\EditorEngine.cpp:1958]
UnrealEditor_UnrealEd!UUnrealEdEngine::Tick() [D:\build\++UE5\Sync\Engine\Source\Editor\UnrealEd\Private\UnrealEdEngine.cpp:519]
UnrealEditor!FEngineLoop::Tick() [D:\build\++UE5\Sync\Engine\Source\Runtime\Launch\Private\LaunchEngineLoop.cpp:5812]
UnrealEditor!GuardedMain() [D:\build\++UE5\Sync\Engine\Source\Runtime\Launch\Private\Launch.cpp:188]
UnrealEditor!GuardedMainWrapper() [D:\build\++UE5\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:107]
UnrealEditor!LaunchWindowsStartup() [D:\build\++UE5\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:244]
UnrealEditor!WinMain() [D:\build\++UE5\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:284]
UnrealEditor!__scrt_common_main_seh() [D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288]
kernel32
ntdll

any idea?