Overview
| Artifact ID: | c2b4c26426640a5327fa08c442da8150c5944ba6 |
|---|---|
| Ticket: | 987512ffffffffffffffffffffffffffffffffff
mem-leak in thread::send -async |
| User & Date: | vasiljevic on 2004-07-11 16:25:54 |
Changes
- icomment:
Logged In: YES user_id=95086 OK. All is clear now. You try this and watch the proc virtual size with top utility: time { set thid [thread::create "thread::wait"]; for {set ni 0} {$ni < 25000} {incr ni} { thread::send -async $thid$::Thread } thread::send -async $thid thread::release } Hit this command once, twice and so on and the process memory will always stay at about 15 MB (on Linux). DO NOT try "time {...} 100" for example because this will fill the async event loop queue with tons of events. This is not what we're testing. Just repeat the above time command *by hand* several times in a row. The thing with USE_THREAD_ALLOC is that allocated Tcl memory is never freed. It is kept for process reuse in several per-thread and global buckets. The idea is to put less strain on the malloc's mutex, thus speeding up the whole thing. So, technically speaking, there is no leak. Now this little example does not reveal any problem actually. We have yet to find out what is the real problem you're hitting. It might be that your app loads some non-thread-safe and/or memory leaking extensions. What extensions do you load, if any? What is the pattern of your server app, i.e. what it does? Can you sketch this in couple of lines? The bottom line is that using USE_THREAD_ALLOC, your process may grow over time, but should eventually settle down on some pretty-much constant value. This value might be high, but it should not break your VM. If this is not what you can afford, try compiling without USE_THREAD_ALLOC. This will slow-down the app for sure but will avoid the above. The thing is: you may not even see that your app is slowed down. This depends entirely on what your app is actually doing. It is worth a try. - login: "vasiljevic"
- mimetype: "text/plain"
- username: "vasiljevic"