From: Laura M. <lm...@ya...> - 2003-09-22 20:24:52
|
I connected a memory manager/bounds checker library to a program I compiled under mingw to see if I was overwriting memory anywhere. The library said memory was being deleted that had either already been deleted or had never been allocated. I finally tracked the cause down to the iostream library. If I add an ifstream declaration such as: ifstream fromfile; to a test program, the memory checker reports memory being deleted that is no longer allocated. If I remove the line, it doesn't happen. Had a couple of questions. Is this a bug in the iostream library or is this okay behavior? In the C++ standard, is it all right to call delete on a pointer that has already been deleted or set to 0? It's pretty hard to track down memory bugs when some of the alert messages are coming from the iostream library instead of the program code. Any help in figuring out whether this is a bug or appropriate behavior based on the C++ standard would be greatly appreciated. Thanks. Laura Michaels http://www.distasis.com/cpp/ __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com |