Article View: comp.windows.interviews
Article #752Re: Possible bug IVbeta3 Tables (include/OS/table.h)
From: Bhogavalli Narasimha
Date: Fri, 16 Oct 1992 15:13
Date: Fri, 16 Oct 1992 15:13
43 lines
2582 bytes
2582 bytes
> > After running purify (a program for helping detect memory leaks) over an > interviews program, it indicated that some already freed memory was being > read during a table iterator next call. The code which causes this > problem looks as follows: > > for(TableIterator(TableMethodsImpl) i(*_table); i.more(); i.next()) > _table->remove(i.cur_key()); > > The memory is freed in Table(TableMethodsImpl)::remove and then > accessed very soon afterwards. It occurs before anything else is freed. > It is accessed in TableIterator(TableMethodsImpl)::next. The obvious > problem is deleting memory while using an iterator. As I am not very > good at debugging problems like this, I would appreciate some way to > solve this problem. One way would be a properly written Table::clear > routine, rather than implmenting it myself. > > > -- > +-----------------+-------------------------------+-------------------------+ > | Bill Poitras | Molecular Simulations Inc. | Tel (408)522-9229 | > | (bill) | Sunnyvale, CA USA | | > | | FAX (408)732-0831 | bill@msi.com | > +-----------------+-------------------------------+-------------------------+ > I have a very similar problem in a Unidraw program (IV 3.1beta, Sun OS 4.1.1, sun C++ 2.1). We have a graphic editor which creates Nodes (derived from GraphicComps) and deletes them later in the program. The program crashes after running for some time and usually the error is not repeatable (doesn't crash at the same point always). The program crashes in line browser(class Editor)->Update(); dbx shows that it is crashing in function ivUHashElem(.. ) which is accessing some Hash tables. Following the pointers indicated that browser->Update() was trying to dereference pointers to Nodes which were earlier "Removed" and the memory explicitly deleted. I am not able to create the exact error message now as I temporarily do not have the data of my program. Hope this is a real bug and it get's fixed Narasimha Rao (bhogaval@phaser.ssc.gov)
Technical Details
Message-ID:
<9210161513.AA06185@phaser.ssc.gov>Path:
arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!phaser.ssc.gov!bhogavalShow Full Headers
Complete Article Headers
Newsgroups: comp.windows.interviews Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!phaser.ssc.gov!bhogaval From: bhogaval@phaser.ssc.gov (Bhogavalli Narasimha) Subject: Re: Possible bug IVbeta3 Tables (include/OS/table.h) Message-ID: <9210161513.AA06185@phaser.ssc.gov> Sender: news@shelby.stanford.edu (USENET News System) Organization: Internet-USENET Gateway at Stanford University Date: Fri, 16 Oct 1992 15:13:32 GMT Lines: 43