[Spice-devel] Allocation style in QXLDOD

Christophe de Dinechin dinechin at redhat.com
Tue Mar 21 18:12:54 UTC 2017


Hi Vadim,


Looking at the code for QxlDod.cpp, I see allocations that look like this:

5c52e50b (Vadim Rozenfeld             2014-09-02 17:36:27 +1000 3169)     m_ModeNumbers = reinterpret_cast<PUSHORT> (new (PagedPool)  BYTE [sizeof (USHORT) * ModeCount]);

and corresponding deallocations that look like this:

165b53d4 (Vadim Rozenfeld             2015-03-30 22:57:12 +1100 3154)     delete [] reinterpret_cast<BYTE*>(m_ModeInfo);
165b53d4 (Vadim Rozenfeld             2015-03-30 22:57:12 +1100 3155)     delete [] reinterpret_cast<BYTE*>(m_ModeNumbers);

I was wondering if there was a rationale behind this way of allocating things vs the more standard:

	m_ModeNumbers = new(PagedPool) USHORT[ModeCount];

and

	delete[] m_ModeNumbers;

?

Thanks
Christophe


More information about the Spice-devel mailing list