What memory leak you talking about?
You made some mistakes in your code, here is correction:
void DrawAll()
{
device->SetFVF(D3DFVF_XYZ);
device->SetStreamSource(0, vbuffer, 0, sizeof(LINE_VERTEX));
D3DXMATRIX worldMatrix;
D3DXMatrixIdentity(&worldMatrix);
device->SetTransform(D3DTS_WORLD, &worldMatrix);
D3DXVECTOR3* pVertices = NULL;
vbuffer->Lock(0, 0, (void**)&pVertices, D3DLOCK_DISCARD);
DWORD numVert = 0;
DWORD numVertices = numLines * 2;
for (DWORD i = 0; i < linesList.size(); i++)
{
pVertices[numVert] = linesList.lFrom;
pVertices[numVert+1] = linesList.lTo;
numVert += 2;
if (numVert > (numVertices - 2))
{
vbuffer->Unlock();
device->DrawPrimitive(D3DPT_LINELIST, 0, numVert / 2);
pVertices = 0;
vbuffer->Lock(0, 0, (void**)&pVertices, D3DLOCK_DISCARD);
numVert = 0;
}
}
vbuffer->Unlock();
if(numVert > 0)
{
device->DrawPrimitive(D3DPT_LINELIST, 0, numVert / 2);
}
linesList.clear();
}
assuming that you have properly created VB with "numVertices" as number of vertices?
EDIT: Moved linesList.clear(); out of if block as it might not get called. Now it is correct.
Does this work?
EDIT2: Additionally you can count how many draw calls you have now (add variable that increments when DrawPrimitive is called and display it to see) and resize your VB verts count if necessary.