From 21a60482d578332d69248eb5e6ae0129fc190bc6 Mon Sep 17 00:00:00 2001 From: Anton Tarasenko Date: Sun, 12 Mar 2023 02:22:31 +0700 Subject: [PATCH] Add `FreeN()` set of methods --- sources/BaseRealm/API/Memory/MemoryAPI.uc | 113 +++++++++++++++++++++- 1 file changed, 109 insertions(+), 4 deletions(-) diff --git a/sources/BaseRealm/API/Memory/MemoryAPI.uc b/sources/BaseRealm/API/Memory/MemoryAPI.uc index 58b3d8d..b4179c6 100644 --- a/sources/BaseRealm/API/Memory/MemoryAPI.uc +++ b/sources/BaseRealm/API/Memory/MemoryAPI.uc @@ -167,11 +167,11 @@ public function AcediaObject AllocateByReference_S( return Allocate(class(classToAllocate), forceNewInstance); } -/// Releases one reference to a given `AcediaObject`, calling its finalizers in case all references -/// were released. +/// Releases one reference to a given [`AcediaObject`], calling its finalizers in case +/// all references were released. /// -/// Method will attempt to store `objectToRelease` in its object pool once deallocated, unless it is -/// forbidden by its class' settings. +/// Method will attempt to store [`objectToRelease`] in its object pool once deallocated, +/// unless it is forbidden by its class' settings. public function Free(AcediaObject objectToRelease) { local AcediaObjectPool relevantPool; @@ -189,6 +189,111 @@ public function Free(AcediaObject objectToRelease) { } } +/// Releases references to given [`AcediaObject`]s, calling their finalizers in case +/// all references were released. +/// +/// Method will attempt to store released objects in its object pool once deallocated, +/// unless it is forbidden by its class' settings. +public function Free2(AcediaObject objectToRelease1, AcediaObject objectToRelease2) { + Free(objectToRelease1); + Free(objectToRelease2); +} + +/// Releases references to given [`AcediaObject`]s, calling their finalizers in case +/// all references were released. +/// +/// Method will attempt to store released objects in its object pool once deallocated, +/// unless it is forbidden by its class' settings. +public function Free3( + AcediaObject objectToRelease1, + AcediaObject objectToRelease2, + AcediaObject objectToRelease3 +) { + Free(objectToRelease1); + Free(objectToRelease2); + Free(objectToRelease3); +} + +/// Releases references to given [`AcediaObject`]s, calling their finalizers in case +/// all references were released. +/// +/// Method will attempt to store released objects in its object pool once deallocated, +/// unless it is forbidden by its class' settings. +public function Free4( + AcediaObject objectToRelease1, + AcediaObject objectToRelease2, + AcediaObject objectToRelease3, + AcediaObject objectToRelease4 +) { + Free(objectToRelease1); + Free(objectToRelease2); + Free(objectToRelease3); + Free(objectToRelease4); +} + +/// Releases references to given [`AcediaObject`]s, calling their finalizers in case +/// all references were released. +/// +/// Method will attempt to store released objects in its object pool once deallocated, +/// unless it is forbidden by its class' settings. +public function Free5( + AcediaObject objectToRelease1, + AcediaObject objectToRelease2, + AcediaObject objectToRelease3, + AcediaObject objectToRelease4, + AcediaObject objectToRelease5 +) { + Free(objectToRelease1); + Free(objectToRelease2); + Free(objectToRelease3); + Free(objectToRelease4); + Free(objectToRelease5); +} + +/// Releases references to given [`AcediaObject`]s, calling their finalizers in case +/// all references were released. +/// +/// Method will attempt to store released objects in its object pool once deallocated, +/// unless it is forbidden by its class' settings. +public function Free6( + AcediaObject objectToRelease1, + AcediaObject objectToRelease2, + AcediaObject objectToRelease3, + AcediaObject objectToRelease4, + AcediaObject objectToRelease5, + AcediaObject objectToRelease6 +) { + Free(objectToRelease1); + Free(objectToRelease2); + Free(objectToRelease3); + Free(objectToRelease4); + Free(objectToRelease5); + Free(objectToRelease6); +} + +/// Releases references to given [`AcediaObject`]s, calling their finalizers in case +/// all references were released. +/// +/// Method will attempt to store released objects in its object pool once deallocated, +/// unless it is forbidden by its class' settings. +public function Free7( + AcediaObject objectToRelease1, + AcediaObject objectToRelease2, + AcediaObject objectToRelease3, + AcediaObject objectToRelease4, + AcediaObject objectToRelease5, + AcediaObject objectToRelease6, + AcediaObject objectToRelease7 +) { + Free(objectToRelease1); + Free(objectToRelease2); + Free(objectToRelease3); + Free(objectToRelease4); + Free(objectToRelease5); + Free(objectToRelease6); + Free(objectToRelease7); +} + /// Releases one reference for each `AcediaObject` inside the given array `objectsToRelease`, /// calling finalizers for the ones that got all of their references released. ///