bugSimulavr: an AVR simulator - Bugs: bug #13680, new MirrorNet in Pin causes memory...

 
 

bug #13680: new MirrorNet in Pin causes memory leak

Submitted by:  None
Submitted on:  Thu 07 Jul 2005 10:31:05 PM UTC  
 
Category: SimulationSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: Klaus Rudolph <zfrdh>
Originator Email: -unavailable-Open/Closed: Closed
Component Version: None

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Fri 08 Jul 2005 07:55:35 AM UTC, comment #1:

Thanks for your report.

The problem is fixed on my local copy simply by
calling delete(this) in the Delete function. As
protection against unwanted users which could not know
about this "side effect" I have declared Delete as private
and make Pin::RegisterNet a friend.

connectedTo is also now a private.

Making a "delete this" call is allways a bit misterious code.
If you could not agree with this solution lets discuss
the problem for a better solution.

I actually could not commit my sources and so you maybe
have to wait until >= 18 July for the files. Sorry
for that, I am a bit bussy :-)

Regards,

Klaus

Klaus Rudolph <zfrdh>
Project AdministratorIn charge of this item.
Thu 07 Jul 2005 10:31:05 PM UTC, original submission:

I detected memory leak about 0.6 MB/sec in my program. Valgrind showed that it is MirrorNets in Pin constructors.

As I see MirrorNet cannot to delete itself :) I even tried to add next lines to Net.RegisterNet

// not good solution, but otherwise we get memory leak
if(dynamic_cast<MirrorNet*>(connectedTo)){
delete connectedTo;
connectedTo = 0;
}

But this causes other problems when pin is assigned to another pin. Pointer is copied and MirrorNet is freed more than once.

There should be some solution. By the way, Pin.connectedTo is public which may cause more problems.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follow 5 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Mon 25 Jul 2005 06:08:17 PM UTCzfrdhStatusIn Progress=>Fixed
  Open/ClosedOpen=>Closed
Fri 08 Jul 2005 07:55:35 AM UTCzfrdhStatusNone=>In Progress
  Assigned toNone=>zfrdh
Thu 07 Jul 2005 10:31:05 PM UTCNoneCarbon-Copy-=>Added olegus --AT-- ut --DOT-- ee

Back to the top


Powered by Savane 3.1-cleanup1