Clear the memoy after repeated simulation in Visual studio 2017

24 views
Skip to first unread message

Ammar Alhosainy

unread,
Mar 9, 2017, 12:56:43 PM3/9/17
to ns-3-users
I am using ns-3 on windows using VS2017, I have to repeat the simulation several times with different seed numbers. I created a ns-3 script that runs and destroys the simulation after. The problem is that the visual studio does not reset the memory used, after the execution of (Simulator::Destroy()), the memory consumed, shown by the diagnostic tool, stays the same and increases with the next repeated simulation?

Does anyone have the same problem?

Ammar Alhosainy

unread,
Mar 10, 2017, 8:54:08 PM3/10/17
to ns-3-users
I had to manually clear the application buffers in order to reduce the memory consumption after each simulation 

for (uint j = 0; j < N_NODES; j++)
{
for (uint8_t i = 0; i < c.Get(j)->GetNApplications(); i++)
{
Ptr<Application> app = c.Get(j)->GetApplication(i);
Ptr<TfrcApplicationDccp> myApp = DynamicCast<TfrcApplicationDccp>(app);
if (myApp != NULL)
{
Ptr<Socket> ss = myApp->GetSocket();
Ptr<DccpSocketImpl> soc = DynamicCast<DccpSocketImpl>(ss);
soc->m_txBuffer.clear();
soc->m_rxBuffer.clear();

Tommaso Pecorella

unread,
Mar 11, 2017, 9:02:38 AM3/11/17
to ns-3-users
Hi,

I'm glad you did find the solution, but there's no DccpSocketImpl in ns-3. This means that you're using an unsupported (by us) module and we can't make sure that these are bug free or that they do release gracefully the memory.
It seems, indeed, that the model developer forgot to release some buffers...

Cheers,

T.
Reply all
Reply to author
Forward
0 new messages