Handling memory from your C++ classes
I am writing some functionality in C++. I need to allocate some memory and I'm wondering what sort of memory management is availabke within UDK?
I have seen FMalloc & FMemory and I have read through the wiki Dynamic Memory Allocation
The thing is that most of the documentation seems to talk about spawning Actors etc, and how to manage those which is different to what I need.
I am wondering if there are functions in UDK which allows me to provide a block of memory which I then new & delete from later? Or is there some other scheme I should be using for managing my memory?
I did note this:
So do I simply just use FMemory::Malloc & Fmemory::Free? How do I call constructors on my objects I want to use? new(myMemory) MyClass(construct) ?
How do I control life cycle? Do I need to worry about fragmentation?
Maybe you should tell us what you need. :-)
There are some specialised pooled allocators and the like too, but I think the above advice is probably sufficient for anything involving constructors (which is all I have to go on).
Fragmentation is always a concern in a system heavy on runtime allocation, but we tend only to concern ourselves with it when it noticeably affects the user experience.
Hope this helps,
answered Oct 27 '14 at 02:59 PM
Steve Robb STAFF
Follow this question
Once you sign in you will be able to subscribe for any updates here