It seems we do not need to allocate that memory at all. I think we can eliminate the following lines --

@@ -280,7 +285,6 @@
     }

     req->setThreadContext(id,0);
-    uint8_t *result = new uint8_t[8];

     //No need to do functional simulation
     //We just do timing simulation of the network
@@ -292,9 +296,7 @@
     PacketPtr pkt = new Packet(req, requestType, 0);
     pkt->setSrc(0); //Not used
     pkt->dataDynamicArray(new uint8_t[req->getSize()]);
-    NetworkTestSenderState *state = new NetworkTestSenderState(result);
-    pkt->senderState = state;
-
+    pkt->senderState = NULL;
     sendPkt(pkt);

--
Nilay

On Thu, 5 Apr 2012, Tushar Krishna wrote:

Hi Nilay,
Ah yes, I don't think that memory is being deallocated.
Looking at memtest/memtest.cc after which networktest was modeled, I believe this needs to be done in the completeRequest(PacketPtr pkt) function right?

----------------------------------------------
Request *req = pkt->req;

NetworkTestSenderState *state =
   dynamic_cast<MemTestSenderState *>(pkt->senderState);

uint8_t *data = state->data;

delete state;
delete [] data;
delete pkt->req;
delete pkt;
-----------------------------------------------------------

If this is fine, I'll create a patch, send it for review, and check it in.

cheers,
Tushar


On 04/05/2012 01:16 PM, Nilay Vaish wrote:
Hi Tushar,

In the file networktest.cc, on line 277 a result pointer is allocated memory. Can you point out where this memory is being deallocated?

Thanks
Nilay

_______________________________________________
gem5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

Reply via email to