On Dec 9, 2007, at 7:47 AM, Benny Prijono wrote: > Norman Franke wrote: >> I did re-enable asserts, which is how I found #1 below. I think I >> traced >> it to several issues: >> >> 1. When calls end, the conference port is not automatically released. >> Why not? After a while, 32 active connects were established and >> things > > It should. The idea is when a port is removed, all things related to > this port should have been released. It wasn't, but perhaps that's #428. That assert was in conference.c, sorry. >> 2. I have a recorder that I use to record calls. I had originally >> used a >> single pool for this, and then destroyed and recreated the >> recorder as >> needed. Apparently, the memory was never freed >> by pjmedia_port_destroy and the pool kept growing. After some >> point, it >> would just crash (after the pool reached 1/2 to 3/4 of a MB.) The >> new >> version releases the whole pool and creates a new one when I >> call pjmedia_my_writer_port_create. > > pjmedia_port_destroy() doesn't release the pool since it doesn't own > it, and pool's memory is never freed until the pool itself is > destroyed, these are by design. I suspect the crash is caused by the > pool emitting an exception which is not handled by application. > Although if you said you enabled assertion, you should get assert() > in pj/except.c instead of a crash (see pj_throw_exception_() > function). That I understand. I should it would release the memory it was using in the pool, or doesn't it work that way? I never did run out of memory, it just kept growing and eventually crashed. It looked like the pool became corrupted somehow. >> With these two changes, I haven't had a crash in a day. However, I'm >> still puzzled why it crashed? I never used the pools in another >> thread, >> just to create the ports. >> >> I did try PJ_SAFE_POOL earlier and besides slowing the audio down to >> where it was garbled, I never got an error after a large number of >> test >> calls. > > I'm also puzzled. The crash in pool.c that you mentioned before > seems to suggest that the pool's internal data might have been > reset, and I thought it may have been caused by the pool being > released more than once, so PJ_SAFE_POOL should catch this. > Apparently it didn't, so I'm puzzled. Again, it never did run out of memory. Just crashed while walking the linked list in the pools. So far, no crashes in a few days. -Norman