|
|
@ -19,7 +19,7 @@ |
|
|
|
* You should have received a copy of the GNU General Public License |
|
|
|
* You should have received a copy of the GNU General Public License |
|
|
|
* along with Acedia. If not, see <https://www.gnu.org/licenses/>. |
|
|
|
* along with Acedia. If not, see <https://www.gnu.org/licenses/>. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
class MemoryAPI extends AcediaObject; |
|
|
|
class MemoryApi extends AcediaObject; |
|
|
|
|
|
|
|
|
|
|
|
//! API that provides functions for managing object of classes, derived from `AcediaObject`. |
|
|
|
//! API that provides functions for managing object of classes, derived from `AcediaObject`. |
|
|
|
//! |
|
|
|
//! |
|
|
@ -35,15 +35,15 @@ class MemoryAPI extends AcediaObject; |
|
|
|
//! First of all, this API is only meant for non-actor `Object` creation. |
|
|
|
//! First of all, this API is only meant for non-actor `Object` creation. |
|
|
|
//! `Actor` creation is generally avoided in Acedia and, when unavoidable, different APIs |
|
|
|
//! `Actor` creation is generally avoided in Acedia and, when unavoidable, different APIs |
|
|
|
//! are dealing with that. |
|
|
|
//! are dealing with that. |
|
|
|
//! `MemoryAPI` is designed to work in the absence of any level (and, therefore, `Actor`s) at all. |
|
|
|
//! `MemoryApi` is designed to work in the absence of any level (and, therefore, `Actor`s) at all. |
|
|
|
//! |
|
|
|
//! |
|
|
|
//! Simply use `MemoryAPI.Allocate()` to create a new object and `MemoryAPI.Free()` to get rid of |
|
|
|
//! Simply use `MemoryApi.Allocate()` to create a new object and `MemoryApi.Free()` to get rid of |
|
|
|
//! unneeded reference. |
|
|
|
//! unneeded reference. |
|
|
|
//! Do note that `AcediaObject`s use reference counting and object will be deallocated and pooled |
|
|
|
//! Do note that `AcediaObject`s use reference counting and object will be deallocated and pooled |
|
|
|
//! only after every trackable reference was released by `MemoryAPI.Free()`. |
|
|
|
//! only after every trackable reference was released by `MemoryApi.Free()`. |
|
|
|
//! |
|
|
|
//! |
|
|
|
//! Best practice is to only care about what object reference you're keeping, properly release them |
|
|
|
//! Best practice is to only care about what object reference you're keeping, properly release them |
|
|
|
//! with `MemoryAPI.Free()` and to NEVER EVER USE THEM after you've release them. |
|
|
|
//! with `MemoryApi.Free()` and to NEVER EVER USE THEM after you've release them. |
|
|
|
//! Regardless of whether they were actually deallocated. |
|
|
|
//! Regardless of whether they were actually deallocated. |
|
|
|
//! |
|
|
|
//! |
|
|
|
//! There's also a set of auxiliary methods for either loading `class`es from their |
|
|
|
//! There's also a set of auxiliary methods for either loading `class`es from their |
|
|
@ -53,7 +53,7 @@ class MemoryAPI extends AcediaObject; |
|
|
|
//! |
|
|
|
//! |
|
|
|
//! Object pool usage can be disabled completely for your class by setting `usesObjectPool = false` |
|
|
|
//! Object pool usage can be disabled completely for your class by setting `usesObjectPool = false` |
|
|
|
//! in `defaultproperties` block. |
|
|
|
//! in `defaultproperties` block. |
|
|
|
//! Without object pools `MemoryAPI.Allocate()` will create a new instance of your class every |
|
|
|
//! Without object pools `MemoryApi.Allocate()` will create a new instance of your class every |
|
|
|
//! single time. |
|
|
|
//! single time. |
|
|
|
//! |
|
|
|
//! |
|
|
|
//! You can also set a limit to how many objects will be stored in an object pool with |
|
|
|
//! You can also set a limit to how many objects will be stored in an object pool with |
|
|
|