The FastObj class uses global pool. So, the FastObj class may be used with polymorphic classes in contrast to FastObjT class. Any allocation/deallocation operations use mem_get_sized() and mem_put_sized() functions.
To use fast memory management your class should be derived from the FastObj class. See the example below.
class MyClass: public omni::pool::FastObj { // ... }; class Test: public MyClass { // ... }; void f() { MyClass *p1 = new MyClass(); // mem_get_sized() used // ... delete p1; // mem_put_sized() used Test *p2 = new Test(); // mem_get_sized() used // ... delete p2; // mem_put_sized() used }
| FastObj | ( | ) | [protected] |
Trivial constructor.
| ~FastObj | ( | ) | [protected, virtual] |
Trivial virtual destructor.
| void * operator new | ( | size_t | buf_size | ) | [static] |
The memory allocation.
This operator allocates the buf_size bytes memory block using mem_get_sized() function.
| std::bad_alloc | If no memory is available. |
| [in] | buf_size | The memory block size. |
| void * operator new | ( | size_t | buf_size, | |
| const std::nothrow_t & | ||||
| ) | [static] |
The memory allocation.
This operator allocates the buf_size bytes memory block using mem_get_sized() function.
If there is no available memory, then this operator will return null pointer.
| [in] | buf_size | The memory block size. |
| void * operator new | ( | size_t | buf_size, | |
| void * | p | |||
| ) | [static] |
Placement new operator.
This operator is used only for correct overloading of other new operators. It uses global placement new operator.
| [in] | buf_size | The memory block size. |
| [in] | p | The memory block. |
| void operator delete | ( | void * | buf | ) | [static] |
The memory deallocation.
This operator deallocates the buf memory block using mem_put_sized() function.
| [in] | buf | The memory block. |
| void operator delete | ( | void * | buf, | |
| const std::nothrow_t & | ||||
| ) | [static] |
The memory deallocation.
This operator deallocates the buf memory block using mem_put_sized() function.
| [in] | buf | The memory block. |
| void operator delete | ( | void * | buf, | |
| void * | p | |||
| ) | [static] |
Placement delete operator?
This operator is used only for correct overloading of other delete operators. It uses global placement delete operator.
| [in] | buf | The memory block? |
| [in] | p | The memory block? |
1.5.2