(Port-induced?) memory leak in 2.0
Bob Purvy
bpurvy at packeteer.com
Mon Mar 12 18:55:45 EST 2001
I've gotten 2.0 sort of working on pSOS, our embedded "operating
system." Right now I'm seeing memory leaks after a call to Py_Main()
(so we can have a "enter Python shell" command in our command-line
interface), which I've verified in the debugger calls Py_Initialize()
once and Py_Finalize() twice
(but the second call doesn't do anything since the initilize flag is
off).
I've replaced all the mem calls with kmalloc() / krealloc() / kfree(),
so I could check for leaks. There seems to be a ton.
i Type Blocks Allocs Fails Bytes HiWater Limit
Percent
62 python 174 1365 0 21320 139168 1048576
28.19
so there is 21K worth of stuff left over after the Py_Finalize().
I know this is almost certainly going to be something caused by my port,
but if the following list of free nodes gives anyone a hint about what
might be wrong, I'd sure appreciate it if you let me know.
data len: 988
0x03becaa0 00000000 03be8ad0 00000000 45455246 ............FREE
0x03becab0 45455246 03becaa4 45455246 45455246 FREE....FREEFREE
0x03becac0 03becab0 45455246 45455246 03becabc ....FREEFREE....
0x03becad0 45455246 45455246 03becac8 45455246 FREEFREE....FREE
0x03becae0 45455246 03becad4 45455246 45455246 FREE....FREEFREE
0x03becaf0 03becae0 45455246 45455246 03becaec ....FREEFREE....
0x03becb00 45455246 45455246 03becaf8 45455246 FREEFREE....FREE
0x03becb10 45455246 03becb04 45455246 45455246 FREE....FREEFREE
0x03becb20 03becb10 45455246 45455246 03becb1c ....FREEFREE....
0x03becb30 45455246 45455246 03becb28 45455246 FREEFREE(...FREE
0x03becb40 45455246 03becb34 45455246 45455246 FREE4...FREEFREE
0x03becb50 03becb40 45455246 45455246 03becb4c @...FREEFREEL...
0x03becb60 45455246 45455246 03becb58 45455246 FREEFREEX...FREE
0x03becb70 45455246 03becb64 45455246 45455246 FREEd...FREEFREE
0x03becb80 03becb70 45455246 45455246 03becb7c p...FREEFREE|...
0x03becb90 45455246 45455246 03becb88 45455246 FREEFREE....FREE
snip
data len: 97
0x03bf5660 be49040a 03bfd4c0 03bfd498 c8f2da46 ..I.........F...
0x03bf5670 03bfd414 03bfbfe8 eccd053d 03bf7b6c ........=...l{..
0x03bf5680 03bfd21c 00000000 00000000 00000000 ................
0x03bf5690 00000000 00000000 00000000 4f7b4c82 .............L{O
0x03bf56a0 03bfd174 03bfd120 502a8d9e 03bfd54c t... .....*PL...
0x03bf56b0 03bfd524 00000000 00000000 00000000 $...............
0x03bf56c0 45455246 45455246 45455246 45455246 F
data len: 193
0x03bf5844 4771c4af 03bffc64 00618c08 502a8d9e ..qGd.....a...*P
0x03bf5854 03bfd54c 03bffb1c eccd053d 03bf7b6c L.......=...l{..
0x03bf5864 03bff914 00000000 00000000 00000000 ................
0x03bf5874 00000000 00000000 00000000 be49040a ..............I.
0x03bf5884 03bfd4c0 03bffb50 4dafdc09 03bffd00 ....P......M....
0x03bf5894 00618c08 7a3ee938 03bffb9c 03bfeb8c ..a.8.>z........
0x03bf58a4 51a7bed7 03bffccc 00618c08 00000000 ...Q......a.....
0x03bf58b4 00000000 00000000 3884f2b5 03bffc98 ...........8....
0x03bf58c4 00618c08 00000000 00000000 00000000 ..a.............
0x03bf58d4 00000000 00000000 00000000 4f7b4c82 .............L{O
0x03bf58e4 03bfd174 03bff9f0 00000000 00000000 t...............
0x03bf58f4 00000000 00000000 00000000 00000000 ................
0x03bf5904 45455246 45455246 45455246 45455246 F
data len: 12
0x03bf6b44 00000001 00618b1c 03bf7a9c 45455246 ......a..z..
data len: 35
0x03bf7528 0000002d 0061a328 0000000b ffffffff -...(.a.........
0x03bf7538 00000000 6d75643c 6b20796d 003e7965 ....<dummy key>.
0x03bf7548 45455246 45455246 45455246 45455246 FRE
data len: 70
0x03bf76d4 00000001 0061a328 0000002e ffffffff ....(.a.........
0x03bf76e4 00000000 65736142 616c6320 66207373 ....Base class f
0x03bf76f4 6120726f 73206c6c 646e6174 20647261 or all standard
0x03bf7704 68747950 65206e6f 70656378 6e6f6974 Python exception
0x03bf7714 45002e73 45455246 45455246 45455246 s..EFR
data len: 25
0x03bf7884 00000003 0061a328 00000001 d4cb6ede ....(.a......n..
0x03bf7894 03bf7884 4545005f 45455246 45455246 .x.._.EEF
data len: 33
0x03bf7940 00000003 0061a328 00000009 9ec16a0f ....(.a......j..
0x03bf7950 03bf7940 5f706d63 74617473 45450065 @y..cmp_state.EE
0x03bf7960 45455246 45455246 45455246 45455246 F
data len: 44
0x03bf7994 03bf7a90 0061eef4 45455246 00000001 .z....a.FREE....
0x03bf79a4 0061891c 00000096 0000006a 00000100 ..a.....j.......
0x03bf79b4 0000011d 03bfa850 004842e0 45455246 ....P....BH.
data len: 36
0x03bf79e8 00000004 0061a328 0000000c b8b08ac8 ....(.a.........
0x03bf79f8 03bf79e8 75625f5f 69746c69 5f5f736e .y..__builtins__
0x03bf7a08 45455200 45455246 45455246 45455246 .REE
data len: 44
0x03bf7a90 03bfb8b8 03bf7994 45455246 00000002 .....y..FREE....
0x03bf7aa0 0061891c 00000059 00000059 00000100 ..a.Y...Y.......
0x03bf7ab0 0000011d 03c02168 004842e0 45455246 ....h!...BH.
data len: 32
0x03bf7ae4 00000005 0061a328 00000008 3cfa8ed9 ....(.a........<
0x03bf7af4 03bf7ae4 616e5f5f 5f5f656d 45455200 .z..__name__.REE
data len: 34
0x03bf7b18 00000003 0061a328 0000000a 2e1f7e1b ....(.a......~..
0x03bf7b28 03bf7b18 6e697369 6e617473 45006563 .{..isinstance.E
0x03bf7b38 45455246 45455246 45455246 45455246 FR
data len: 31
0x03bf7b6c 0000000a 0061a328 00000007 eccd053d ....(.a.....=...
0x03bf7b7c 03bf7b6c 6f645f5f 005f5f63 45455246 l{..__doc__.FRE
................ many more
More information about the Python-list
mailing list