Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualZaoshi Kaba

Posted 03 January 2013 - 12:48 PM

Since you used _aligned_malloc you'll have to use _aligned_free.

renderer->~Renderer(); // manually call destructor_aligned_free(renderer);


Edit:
You could overload new and delete operators as well, then you won't have to call constructor/destructor manually, and it allows use of smart pointers.:

struct AlignedAllocator {
	void* operator new(size_t size) {
		return _aligned_malloc(size, 16);
	}

	void operator delete(void *ptr) {
		_aligned_free(ptr);
	}
};

struct Renderer : AlignedAllocator {
	// ...
};

 

 


#1Zaoshi Kaba

Posted 03 January 2013 - 12:44 PM

Since you used _aligned_malloc you'll have to use _aligned_free.

 

renderer->~Renderer(); // manually call destructor
_aligned_free(renderer);

PARTNERS