Baigudin Software avatar
Baigudin Software logo
home
ru region
en region

Class «library::Heap»

Heap memory.

Hardware address for system heap memory has to be aligned to eight.

public: Heap(int64 size);

Constructor.

Parameters:
size — total heap size.

public: Heap(int64 size, api::Toggle*& toggle);

Constructor.

Reference to global interrupt interface pointer is used for a possibility to change a value of that pointer. Until that pointer is NULL global interrupt is not used. This gives you a possibility to change using global interrupts on fly.

Parameters:
size — total heap size.
toggle — reference to pointer to global interrupts toggle interface.

public: virtual ~Heap();

Destructor.

public: virtual void* allocate(size_t size, void* ptr);

Allocates memory.

Parameters:
size — required memory size in byte.
ptr — NULL value becomes to allocate memory, and other given values are simply returned as memory address.

Returns:
pointer to allocated memory or NULL.

public: virtual void free(void* ptr);

Frees an allocated memory.

Parameters:
ptr — pointer to allocated memory.

public: virtual bool isConstructed() const;

Tests if this object has been constructed.

public: static bool isObject(const Type* obj);

Tests if given object has been constructed object.

public: void operator delete(void*, void*);

Operator delete.

Parameters:
ptr — address of allocated memory block or a null pointer.
place — pointer used as the placement parameter in the matching placement new.

public: void* operator new(size_t, void* ptr);

Operator new.

Method initiates a building of heap memory checks and tests self memory structure data and leads to call the class constructor.

Parameters:
size — unused.
ptr — aligned to eight memory address.

Returns:
address of memory or NULL.

public: virtual void setToggle(::api::Toggle*& toggle);

Sets an allocated memory.

The method allows disabling and enabling thread context switching when memory is being allocated or freed. Thus, the best way is to pass an interface of global interrupt toggling. The parameter type is reference to pointer, as when referenced pointer equals to NULL, no blocks are happening.

Parameters:
toggle — reference to pointer to some controller.

Back to class list