|
From: Jaap de W. <wo...@ne...> - 2003-07-14 12:37:41
|
Hmm, I had problems like this also. Are you using a multithreaded environment? Is it possible that sometimes two threads at the same time are accessing the map, one for removing a key, and one for finding a key? Jaap > -----Original Message----- > From: Shane Bryldt [mailto:ast...@te...] > Sent: Friday, July 11, 2003 10:53 PM > To: Hossein Haeri > Cc: C++ > Subject: Re: [Dev-C++] STL Map question > ... > > Now, the effect of the issue, is as follows. A network of 6,000-10,000 > active users at any given time is regulated by a security > service. This > service runs and connects like a user, with special > priviledges. Anytime a > user connects to the network, the services is informed, and > the User is > added to a global UserList. The network also has smaller > units, known as > Channels. Each Channel contains 3 UserList's as well. > First, depicts all > users in the Channel, the second depicts all the operators of > the channel, > and the third depicts the priviledged users who are not > operators. 99% of > the time, the code work fine. Users constantly added and > removed from the > list. Periodically, what seems like an issue without a > pattern, the code > will crash with a segmentation fault while trying to call > "std::map<>::find()", with a valid key. Whether the key is > in the map, is > not definate, but the key passed in valid and should not have > a problem > being searched. > > This said, I have narrowed the issue down to one of 2 causes. > 1) Either > User's are being added to lists, and not being removed, and > the UserLists > are eventually gathering enough garbage that out of memory is being > encountered. The application has a signal hook for out of > memory, and it is > not being raised. So I am leaning more towards option 2) The > User class is > being deleted, without being removed from the UserList. > However, I can find > no indication of this in the code. The code is many > thousands of lines, it > is not a small project by any means. Providing the source > for the issue, > would require the entire project as the issue is not > specifically a syntax > issue, but rather a situational issue. I do believe something has > invalidated a User class, which a UserList has a pointer to, > and when trying > to use it, is causing a segmentation fault. I'm sure most of > the experts > here will agree with my conclusion and realize tracing this > problem is no > easy task. > > ... |