[Spice-devel] Allocation style in QXLDOD

Vadim Rozenfeld vrozenfe at redhat.com
Fri Mar 24 06:49:46 UTC 2017


On Tue, 2017-03-21 at 19:12 +0100, Christophe de Dinechin wrote:
> 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;
> 
> ?

just silly leftovers after my playing with WinDbg, trying to trace
some memory allocation problem at that time.

Cheers,
Vadim.

> 
> Thanks
> Christophe


More information about the Spice-devel mailing list