Re: [cx-oracle-users] assistance in analyzing memory usage?
Brought to you by:
atuining
From: Mark H. <mh...@pi...> - 2005-09-29 18:52:22
|
Hancock, David (DHANCOCK) wrote: > Sorry to say I haven't got any solution to offer, but just a question: How does your memsnap() function work? I just hacked something like it to help us with other memory leak problems, but I'd like to see another implementation, because it's sure to be better than mine (mine saves sys.argv[0] to a string, and does a "ps auxww | grep 'that string' | grep -v grep" > > Thanks, and > Cheers! Heh, yours is probably better than mine coz I did the same and just hard-coded the executable name. Here's a nice grep tip: if you put the first character of the grep pattern in square brackets you won't need the final grep -v, coz the string "[q]" doesn't match the regular expression "[q]". def memsnap(note): print '---', note os.system("ps auxww|grep '[q]2'") If you don't mind a linux-only solution, you can open /proc/PID/status where the memory stats are available in a nicely parsable form. I've also been pointed to memusage on linux which will produce nice graphs. HTH! Mark -- Mark Harrison Pixar Animation Studio |