- Unreal Engine 4 Scripting with C++ Cookbook
- William Sherif Stephen Whittle
- 139字
- 2021-07-08 10:50:50
Managed memory – deallocating memory
UObject
s are reference-counted and garbage-collected when there are no more references to the UObject
instance. Memory allocated on a UObject
class derivative using ConstructObject<>
or NewObject< >
can also be deallocated manually (before the reference count drops to 0) by calling the UObject::ConditionalBeginDestroy()
member function.
Getting ready
You'd only do this if you were sure you no longer wanted UObject
or the UObject
class derivative instance in memory. Use the ConditionalBeginDestroy()
function to release memory.
How to do it...
The following code demonstrates the deallocation of a UObject class
:
UObject *o = NewObject< UObject >( ... ); o->ConditionalBeginDestroy();
How it works…
The command ConditionalBeginDestroy()
begins the deallocation process, calling the BeginDestroy()
and FinishDestroy()
overrideable functions.
There's more…
Be careful not to call UObject::ConditionalBeginDestroy()
on any object still being referenced in memory by other objects' pointers.
- Instant Node Package Manager
- C語言程序設計基礎與實驗指導
- Mastering matplotlib
- Cassandra Design Patterns(Second Edition)
- Oracle數據庫從入門到運維實戰
- Python數據可視化之Matplotlib與Pyecharts實戰
- Drupal 8 Configuration Management
- 軟件測試實用教程
- Visualforce Developer’s guide
- 從零學Java設計模式
- 視窗軟件設計和開發自動化:可視化D++語言
- Applied Deep Learning with Python
- Keil Cx51 V7.0單片機高級語言編程與μVision2應用實踐
- 征服C指針(第2版)
- Mastering Node.js