Tulip Rasputin wrote: > Hi, > > This isnt really a "C" question per se, so readers can ignore this question > if they want to .. However, i am sure there would be folks here who would > the answer to this question .. > > I have a BIG application and when its shutting down it gives a core dump. Its > a case of a memory corruption, and some task it seems is overwriting my data > structures (basically linked lists) and it crashes when i try to free the > memory associated with the linked list. > > Note that this only happens when i try to shut down my task. I have the > following question. > > When my task is shutting down wont the OS (linux or solaris) anyways free all > the memory associated with that task? If thats the case then i dont need to > explicitly free the memory as the OS would do it for me. Is this correct? > > Also, i have seen this in some other programs, which when close dont free the > memory. They expect the OS to do it automatically when the process dies. Is > this correct? > > Thanks, > Tulip
If you design your application correctly, it should automatically free all memory on its own. I haven't had a single application crash in months. Brett already mentioned reading "Safe C++ Design Principles". I second that - you'll write better code after reading it. Cleaning up after yourself is important - but letting the programs you write do it for you is infinitely better. -- Thomas Hruska CubicleSoft President Ph: 517-803-4197 *NEW* VerifyMyPC 2.2 Change tracking and management tool. Reduce tech. support times from 2 hours to 5 minutes. Free for personal use, $10 otherwise. http://www.CubicleSoft.com/VerifyMyPC/
