473,385 Members | 1,341 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Where are the strings in gc.get_objects?

Hello all. I'm tracking down memory leaks in my app. To do this I wrote a
script to show the numbers of each different type of object. But it doesn't
show strings! Here is the script:

import gc,types

def printDict(d):
keys = d.keys() ; keys.sort()
print '-' * 30
for key in keys:
n = d.get(key)
print '%+6d %s' % (n,key)

d = {} ; d2 = {}
for obj in gc.get_objects():
t = type(obj)
r = repr(t)
n = d.get(r,0)
d[r] = n + 1
if t == types.InstanceType:
t = obj.__class__
r = repr(t)
n = d2.get(r,0)
d2[r] = n + 1

printDict(d)
printDict(d2)

And here is example output. The first part of the listing shows the 'raw'
type of each object, the second part of the listing shows
type(obj.__class__) for instance types.

------------------------------
+1925 <class 'leoGlobals.Bunch'>
+1 <class 'leoNodes.nodeIndices'>
+47 <class 'leoNodes.position'>
+2858 <class 'leoNodes.tnode'>
+2877 <class 'leoNodes.vnode'>
+1 <class 'random.Random'>
+1 <class 'site._Helper'>
+3 <class 'site._Printer'>
+1 <class 'string._TemplateMetaclass'>
+1 <class 'threading._Condition'>
+1 <class 'threading._MainThread'>
+1 <class 'unittest.TestLoader'>
+536 <type 'builtin_function_or_method'>
+27 <type 'cell'>
+1 <type 'classmethod'>
+1 <type 'classmethod_descriptor'>
+538 <type 'classobj'>
+11942 <type 'dict'>
+14 <type 'frame'>
+8493 <type 'function'>
+3 <type 'generator'>
+70 <type 'getset_descriptor'>
+1997 <type 'instance'>
+3704 <type 'instancemethod'>
+4441 <type 'list'>
+72 <type 'member_descriptor'>
+226 <type 'method_descriptor'>
+181 <type 'module'>
+1 <type 'property'>
+29740 <type 'tuple'>
+1 <type 'tupleiterator'>
+53 <type 'type'>
+105 <type 'weakref'>
+362 <type 'wrapper_descriptor'>
------------------------------
+1 <class Pmw.Pmw_1_2.lib.PmwLoader.PmwLoader at 0x0156D390>
+1 <class Tkinter.BitmapImage at 0x0154E5D0>
+30 <class Tkinter.Button at 0x0154E270>
+1 <class Tkinter.CallWrapper at 0x0154E030>
+5 <class Tkinter.Canvas at 0x0154E2A0>
+9 <class Tkinter.Checkbutton at 0x0154E2D0>
+1 <class Tkinter.Event at 0x01540EA0>
+51 <class Tkinter.Frame at 0x0154E330>
+15 <class Tkinter.IntVar at 0x01540F30>
+11 <class Tkinter.Label at 0x0154E360>
+3 <class Tkinter.Listbox at 0x0154E390>
+61 <class Tkinter.Menu at 0x0154E3C0>
+7 <class Tkinter.PhotoImage at 0x0154E5A0>
+3 <class Tkinter.Radiobutton at 0x0154E450>
+19 <class Tkinter.Scrollbar at 0x0154E4B0>
+5 <class Tkinter.StringVar at 0x01540F00>
+1 <class Tkinter.Tk at 0x0154E0C0>
+9 <class Tkinter.Toplevel at 0x0154E240>
+6 <class _Pmw.Pmw_1_2.lib.PmwBalloon.Balloon at 0x0186D870>
+1545 <class _Pmw.Pmw_1_2.lib.PmwBase.__TkinterCallWrapper at 0x015A66F0>
+2 <class _Pmw.Pmw_1_2.lib.PmwNoteBook.NoteBook at 0x0162ECF0>
+1 <class _Pmw.Pmw_1_2.lib.PmwPanedWidget.PanedWidget at 0x016FA360>
+2 <class _Pmw.Pmw_1_2.lib.PmwScrolledFrame.ScrolledFrame at 0x016FADE0>
+3 <class __future__._Feature at 0x00EB6840>
+2 <class compiler.misc.Set at 0x00E899C0>
+1 <class compiler.pyassem.StackDepthTracker at 0x00E89B10>
+3 <class doctest.DocTestParser at 0x00EE50C0>
+2 <class encodings.cp1252.Codec at 0x00ADE1E0>
+2 <class encodings.cp437.Codec at 0x00CF0AE0>
+1 <class exceptions.MemoryError at 0x00A87120>
+1 <class leoApp.LeoApp at 0x00BAF930>
+3 <class leoAtFile.atFile at 0x00DBF180>
+3 <class leoChapters.chapter at 0x015D6660>
+1 <class leoChapters.chapterController at 0x015D6630>
+1 <class leoColor.colorizer at 0x00CCA8A0>
+2 <class leoColor.nullColorizer at 0x00CCA8D0>
+3 <class leoCommands.Commands at 0x00FE1900>
+3 <class leoCommands.configSettings at 0x00FE1930>
+1 <class leoConfig.configClass at 0x00CF03C0>
+1 <class leoConfig.settingsTreeParser at 0x00CF03F0>
+1 <class leoEditCommands.AspellClass at 0x00F20E40>
+3 <class leoEditCommands.abbrevCommandsClass at 0x00F15810>
+3 <class leoEditCommands.bufferCommandsClass at 0x00F20B10>
+3 <class leoEditCommands.controlCommandsClass at 0x00F20B40>
+3 <class leoEditCommands.debugCommandsClass at 0x00F20B70>
+3 <class leoEditCommands.editCommandsClass at 0x00F20BA0>
+3 <class leoEditCommands.editFileCommandsClass at 0x00F20BD0>
+3 <class leoEditCommands.helpCommandsClass at 0x00F20C00>
+3 <class leoEditCommands.keyHandlerCommandsClass at 0x00F20C30>
+3 <class leoEditCommands.killBufferCommandsClass at 0x00F20C60>
+3 <class leoEditCommands.leoCommandsClass at 0x00F20C90>
+3 <class leoEditCommands.macroCommandsClass at 0x00F20CC0>
+3 <class leoEditCommands.queryReplaceCommandsClass at 0x00F20CF0>
+3 <class leoEditCommands.rectangleCommandsClass at 0x00F20D20>
+3 <class leoEditCommands.registerCommandsClass at 0x00F20D50>
+3 <class leoEditCommands.searchCommandsClass at 0x00F20DB0>
+3 <class leoEditCommands.spellCommandsClass at 0x00F20DE0>
+1 <class leoEditCommands.spellTabHandler at 0x00F20E10>
+3 <class leoFileCommands.fileCommands at 0x00F932D0>
+3 <class leoFind.leoFind at 0x00C12840>
+5 <class leoFind.searchWidget at 0x00C12810>
+2 <class leoFrame.nullBody at 0x00CF0210>
+2 <class leoFrame.nullFrame at 0x00CF0240>
+2 <class leoFrame.nullIconBarClass at 0x00CF0270>
+2 <class leoFrame.nullLog at 0x00CF02A0>
+2 <class leoFrame.nullTree at 0x00CF0300>
+6 <class leoFrame.stringTextWidget at 0x00CF00F0>
+2 <class leoGlobals.redirectClass at 0x00BAF420>
+2 <class leoGui.nullGui at 0x00CF0330>
+3 <class leoImport.leoImportCommands at 0x00F93FC0>
+3 <class leoKeys.autoCompleterClass at 0x00E70720>
+3 <class leoKeys.classScannerClass at 0x00E70600>
+3 <class leoKeys.forgivingParserClass at 0x00E705D0>
+2 <class leoKeys.keyHandlerClass at 0x00E707B0>
+2 <class leoMenu.nullMenu at 0x00CDDCC0>
+3 <class leoTangle.tangleCommands at 0x00FE1750>
+1 <class leoTkinterFind.tkFindTab at 0x015AF630>
+1 <class leoTkinterFind.tkSpellTab at 0x015AF660>
+12 <class leoTkinterFind.underlinedTkButton at 0x015AF5D0>
+20 <class leoTkinterFrame.leoTkTextWidget at 0x016006F0>
+1 <class leoTkinterFrame.leoTkinterBody at 0x016005D0>
+1 <class leoTkinterFrame.leoTkinterFrame at 0x01600660>
+1 <class leoTkinterFrame.leoTkinterLog at 0x01600690>
+1 <class leoTkinterFrame.leoTkinterTreeTab at 0x016006C0>
+1 <class leoTkinterFrame.tkIconBarClass at 0x01600630>
+1 <class leoTkinterFrame.tkStatusLineClass at 0x01600600>
+1 <class leoTkinterGui.leoKeyEvent at 0x015B77B0>
+1 <class leoTkinterGui.tkinterGui at 0x01600720>
+1 <class leoTkinterKeys.tkinterKeyHandlerClass at 0x016FA990>
+1 <class leoTkinterMenu.leoTkinterMenu at 0x015DB150>
+3 <class leoTkinterTree.leoTkinterTree at 0x016004E0>
+3 <class leoUndo.undoer at 0x00CF0090>
+1 <class mod_scripting.scriptingController at 0x0162E060>
+1 <class nav_buttons.imageClass at 0x0162E990>
+1 <class nav_buttons.marksDialog at 0x0162E9C0>
+1 <class nav_buttons.recentSectionsDialog at 0x0162EA20>
+1 <class os._Environ at 0x00A9BC30>
+5 <class plugins_menu.PlugIn at 0x01540270>
+1 <class plugins_menu._PluginDatabase at 0x01527B40>
+2 <class repr.Repr at 0x00EDB690>
+10 <class tkFont.Font at 0x015DB120>
+2 <class xml.sax.handler.ErrorHandler at 0x00F75360>

I get similar results on both Python 2.4 and Python 2.5. I'm running on XP.

Can anyone explain were the strings are? I expect at least twice the number
of strings as there are leoNodes.vnode objects.

Edward
--------------------------------------------------------------------
Edward K. Ream email: ed*******@charter.net
Leo: http://webpages.charter.net/edreamleo/front.html
--------------------------------------------------------------------
May 4 '07 #1
1 1998
The following script dumps all objects allocated since the last time it was
called. It suppresses the dump if more than 200 new objects were allocated.
g.app.idDict is a dict whose keys are id(obj) and whose values are obj.
(g.app.idDict will persist between invocations of the script). This allows
us to determine whether an object has already been allocated. It's not a
perfect test,but perfection is not required.

As expected, this stresses the gc a lot. The isLargeItem function is
important: it returns True if repr(obj) would be too big. It tries to avoid
actually generating repr(obj). Even so, sometimes the script appears to hang
while isLargeItem cranks. I thought it would be clever to call isLargeItem
for dict values, but that overflowed the stack.

Anyway, here is the script:

import gc,types

def isLargeItem (obj):

.....if (
.........type(obj) == types.CodeType or
.........type(obj) == types.ListType and len(obj) 500 or
.........type(obj) == types.TupleType and len(obj) 500
.....):
.........return True

.....if type(obj) == types.DictType:
.........n = 0 ; keys = obj.keys()
.........if len(keys) 100: return True
.........for key in keys:
.............val = obj.get(key)
.............# if isLargeItem(val): return True
.............n += len(repr(key))
.............n += len(repr(val))
.............if n 1000: return True
.........return False
.............
.....return len(repr(obj)) 1000

try: d = g.app.idDict
except AttributeError: d = g.app.idDict = {}

new = {}
for obj in gc.get_objects():
.....oldObj = d.get(id(obj))
.....if oldObj is None:
.........new[id(obj)] = obj
.........
keys = new.keys()
print '----- %d new objects' % len(keys)

if len(keys) < 200:
.....keys.sort()
.....n = 0
.....for key in keys:
.........n += 1
.........obj = new.get(key)
.........print '%3d' % (n),key,type(obj),
.........if isLargeItem(obj):
.............print '***** large item'
.........else:
.............print repr(obj)
.....print '====='

for key in keys:
.....d[key] = new.get(key)

And here is some example output:

----- 70129 new objects [first run of script: nothing printed]
----- 118 new objects [second run of script]
1 13723776 <type 'frame'<frame object at 0x00D16880>
2 17053392 <type 'frame'<frame object at 0x010436D0>
3 20219840 <type 'frame'<frame object at 0x013487C0>
4 21927208 <type 'frame'<frame object at 0x014E9528>
5 23088536 <type 'tuple'('5780', '??', '??', '??', '66', '4', '4522765',
'??', '115', '174', '\x02', '-1', 'b', '98', '.232818
72.23282192.23282432.23282472.23282592.23282672.24 029064.24051224.canvas',
'2', '524', '412', '66')
6 23248088 <type 'tuple'('gc', 'types', 'isLargeItem', 'g', 'app',
'idDict', 'd', 'AttributeError', 'new', 'get_objects', 'obj
', 'get', 'id', 'oldObj', 'None', 'keys', 'len', 'sort', 'n', 'key', 'type',
'repr')
7 23293152 <type 'tuple'(<_Pmw.Pmw_1_2.lib.PmwBase.__TkinterCallWra pper
instance at 0x0175AB20>, '5780', '??', '??', '??', '66
', '4', '4522765', '??', '115', '174', '\x02', '-1', 'b', '98',
'.23281872.23282192.23282432.23282472.23282592.232 82672.24029064.2
4051224.canvas', '2', '524', '412', '66')
8 23562680 <type 'frame'<frame object at 0x016789B8>
9 24069264 <type 'list'[]
10 24116944 <type 'dict'{'stack': [], 'v': <vnode
27563632:'getNewObjects'>}
11 24117936 <type 'list'['black', 'blue']
12 24118016 <type 'instancemethod'<bound method
__TkinterCallWrapper.__call__ of
<_Pmw.Pmw_1_2.lib.PmwBase.__TkinterCallWrapper
instance at 0x0295CA08>>
13 24953360 <type 'tuple'('type', 'obj', 'types', 'CodeType', 'ListType',
'len', 'TupleType', 'True', 'DictType', 'n', 'keys',
'key', 'get', 'val', 'repr', 'False')
14 24959216 <type 'tuple'(('command', None), ('insert', None),
('overwrite', None), ('button', None), ('body', 'body'), ('text'
, 'head'), ('tree', 'head'), ('tree', 'canvas'), ('log', 'log'), ('text',
'log'), ('text', None), ('all', None))
15 25585536 <type 'tuple'('obj', 'd', 'oldObj', 'isLargeItem', 'n',
'keys', 'gc', 'key', 'new', 'types')
16 26717792 <type 'frame'<frame object at 0x0197AE60>
17 27405776 <type 'tupleiterator'<tupleiterator object at 0x01A22DD0>
18 27405808 <class 'leoNodes.position'<pos 27405808 lvl: 0 [0]
getNewObjects>
19 27405840 <class 'leoNodes.position'<pos 27405840 lvl: 0 [0]
getNewObjects>
20 27405872 <class 'leoNodes.position'<pos 27405872 lvl: 0 [0]
getNewObjects>
21 27405968 <class 'leoNodes.position'<pos 27405968 [0] None>
22 27406000 <class 'leoNodes.position'<pos 27406000 lvl: 0 [0] Startup>
23 27406032 <class 'leoNodes.position'<pos 27406032 lvl: 0 [0]
Prototypes>
24 27406064 <class 'leoNodes.position'<pos 27406064 lvl: 0 [0] Tests>
25 27406096 <class 'leoNodes.position'<pos 27406096 lvl: 0 [0]
gc.get_objects>
26 27406128 <class 'leoNodes.position'<pos 27406128 lvl: 0 [0] Java>
27 27406160 <class 'leoNodes.position'<pos 27406160 lvl: 0 [0] gc tests>
28 27406192 <class 'leoNodes.position'<pos 27406192 lvl: 0 [0] print sep>
29 27406224 <class 'leoNodes.position'<pos 27406224 lvl: 0 [0]
print-plugins>
30 27406256 <class 'leoNodes.position'<pos 27406256 lvl: 0 [0] byte-code
tests>
31 27406320 <class 'leoNodes.position'<pos 27406320 lvl: 0 [0]
getNewObjects>
32 27564784 <class 'leoNodes.position'<pos 27564784 lvl: 0 [0]
getNewObjects>
33 27571824 <type 'list'***** large item
34 27572704 <type 'list'['black', 'red', 'blue', 'purple']
35 27608960 <type 'dict'{'c': Commander 23254680:
u'C:\\prog\\tigris-cvs\\leo\\test\\test.leo', 'widget': <Tkinter.Canvas
insta
nce at 0x016EFF80>, 'actualEvent': <Tkinter.Event instance at 0x0295C9B8>,
'char': '\x02', 'w': <Tkinter.Canvas instance at 0x016E
FF80>, 'y': 174, 'x': 115, 'keysym': 'b'}
36 27621536 <type 'dict'{'subst': None, 'widget': <Tkinter.Tk instance at
0x016055F8>, 'func': <function callit at 0x0296A030>}

37 27622976 <type 'dict'{}
38 27647312 <type 'tuple'(<function idleTimeHookHandler at 0x00BBEAF0>,
(), <Tkinter.Tk instance at 0x016055F8>, ['24118016call
it'])
39 27647408 <type 'tuple'(None, 500, 0, 100, 1000)
40 27647456 <type 'tuple'('obj', 'val', 'keys', 'n', 'key')
41 43151120 <type 'frame'<frame object at 0x02926F10>
42 43368936 <type 'list'[]
43 43369296 <type 'list'[]
44 43369376 <type 'tuple'(<Tkinter.Event instance at 0x0295C9B8>,)
45 43369496 <type 'list'[]
46 43369696 <type 'list'['24118016callit']
47 43369736 <type 'list'[]
48 43369816 <type 'list'[]
49 43369856 <type 'list'[]
50 43369896 <type 'tuple'(leoTkTextWidget id: 25544304 name: head-6, 27)
51 43370096 <type 'tuple'(<pos 27406032 lvl: 0 [0] Prototypes>, 8)
52 43370216 <type 'tuple'('\x02', u'Ctrl+b')
53 43370296 <type 'instance'tkGui.leoKeyEvent: char: '\x02', keysym: 'b'
54 43370496 <type 'tuple'(<function masterBindKeyCallback at 0x01756AF0>,
(<Tkinter.Event instance at 0x0295C9B8>,))
55 43370616 <type 'list'[]
56 43370656 <type 'tuple'(leoTkTextWidget id: 27572864 name: head-10, 44)
57 43370696 <type 'tuple'(<pos 27406064 lvl: 0 [0] Tests>, 8)
58 43370776 <type 'tuple'(<pos 27406000 lvl: 0 [0] Startup>, 8)
59 43370856 <type 'tuple'(<pos 27406128 lvl: 0 [0] Java>, 8)
60 43370936 <type 'instance'<Tkinter.Event instance at 0x0295C9B8>
61 43370976 <type 'list'[41, 46, 50, 51, 56, 1, 6, 11, 16, 21, 25, 29,
33]
62 43371016 <type 'instance'>
<_Pmw.Pmw_1_2.lib.PmwBase.__TkinterCallWrapper instance at 0x0295CA08>
63 43371056 <type 'list'[7, 12, 17, 42, 52]
64 43371096 <type 'list'[36, 40, 45, 49, 55, 5, 10, 15, 20, 24, 28]
65 43371136 <type 'list'[]
66 43371176 <type 'list'[34, 38, 43, 47, 53, 3, 8, 13, 18, 22, 26]
67 43371216 <type 'list'[]
68 43371256 <type 'list'[]
69 43371296 <type 'list'[]
70 43371336 <type 'list'[]
71 43371576 <type 'tuple'(leoTkTextWidget id: 25544784 name: head-8, 35)
72 43371696 <type 'list'[]
73 43371736 <type 'tuple'(<pos 27406192 lvl: 0 [0] print sep>, 8)
74 43372016 <type 'tuple'(leoTkTextWidget id: 25542984 name: head-2, 9)
75 43372136 <type 'list'[]
76 43372176 <type 'tuple'(leoTkTextWidget id: 27572984 name: head-11, 48)
77 43372376 <type 'tuple'(<pos 27406224 lvl: 0 [0] print-plugins>, 8)
78 43372592 <type 'dict'{'stack': [], 'v': <vnode
27563632:'getNewObjects'>}
79 43372736 <type 'dict'{'keysym_num': 98, 'widget': <Tkinter.Canvas
instance at 0x016EFF80>, 'x_root': 524, 'type': '2', 'delt
a': 66, 'y_root': 412, 'height': '??', 'char': '\x02', 'width': '??',
'state': 4, 'num': '??', 'time': 4522765, 'y': 174, 'x': 115
, 'serial': 5780, 'keysym': 'b', 'keycode': 66}
80 43373168 <type 'dict'{'27563248:5.': (leoTkTextWidget id: 25543504
name: head-3, 14), '27563376:6.': (leoTkTextWidget id: 25
544544 name: head-7, 31), '27563632:9.': (leoTkTextWidget id: 27572424 name:
head-5, 23), '27563440:7.': (leoTkTextWidget id: 2757
2024 name: head-1, 4), '25508048:0.': (leoTkTextWidget id: 27572864 name:
head-10, 44), '27513232:2.': (leoTkTextWidget id: 255447
84 name: head-8, 35), '27562704:3.': (leoTkTextWidget id: 25542984 name:
head-2, 9), '27563152:4.': (leoTkTextWidget id: 27572984
name: head-11, 48), '26446064:1.': (leoTkTextWidget id: 25544304 name:
head-6, 27), '27563536:8.': (leoTkTextWidget id: 25543704 n
ame: head-4, 19), '27563728:0.': (leoTkTextWidget id: 27627608 name:
head-12, 54)}
81 43373312 <type 'dict'***** large item
82 43373456 <type 'dict'{'stack': [], 'v': None}
83 43373600 <type 'dict'{'stack': [], 'v': <vnode
27563632:'getNewObjects'>}
84 43373744 <type 'dict'***** large item
85 43373888 <type 'dict'{'stack': [], 'v': <vnode
27563632:'getNewObjects'>}
86 43374032 <type 'dict'{34: (<pos 27406000 lvl: 0 [0] Startup>, 8), 3:
(<pos 27406224 lvl: 0 [0] print-plugins>, 8), 38: (<pos
27406032 lvl: 0 [0] Prototypes>, 8), 8: (<pos 27406160 lvl: 0 [0] gc
tests>, 8), 43: (<pos 27406064 lvl: 0 [0] Tests>, 8), 13: (<
pos 27406256 lvl: 0 [0] byte-code tests>, 8), 47: (<pos 27406128 lvl: 0 [0]
Java>, 8), 18: (<pos 27406096 lvl: 0 [0] gc.get_object
s>, 8), 53: (<pos 27406192 lvl: 0 [0] print sep>, 8), 22: (<pos 27406320
lvl: 0 [0] getNewObjects>, 8), 26: (<pos 43384912 lvl: 1
[0] isLargeItem>, 8)}
87 43374176 <type 'dict'{'stack': [], 'v': <vnode 27513232:'Tests'>}
88 43374464 <type 'dict'{'stack': [], 'v': <vnode 25508048:'Startup'>}
89 43374608 <type 'dict'{'stack': [], 'v': <vnode 27562704:'Java'>}
90 43374752 <type 'dict'{'stack': [], 'v': <vnode 26446064:'Prototypes'>}
91 43374896 <type 'dict'{'stack': [], 'v': <vnode 27563152:'print sep'>}
92 43375040 <type 'dict'{'stack': [], 'v': <vnode
27563248:'print-plugins'>}
93 43375184 <type 'dict'{'stack': [], 'v': <vnode 27563376:'gc tests'>}
94 43375328 <type 'dict'{'stack': [], 'v': <vnode 27563440:'byte-code
tests'>}
95 43375472 <type 'dict'{'stack': [], 'v': <vnode
27563536:'gc.get_objects'>}
96 43375616 <type 'dict'{'stack': [], 'v': <vnode
27563632:'getNewObjects'>}
97 43376192 <type 'dict'{'stack': [], 'v': <vnode
27563728:'isLargeItem'>}
98 43380784 <type 'list'[]
99 43380824 <type 'tuple'(leoTkTextWidget id: 25543504 name: head-3, 14)
100 43381024 <type 'tuple'(<pos 27406160 lvl: 0 [0] gc tests>, 8)
101 43381184 <type 'list'[]
102 43381224 <type 'tuple'(leoTkTextWidget id: 25544544 name: head-7, 31)
103 43381424 <type 'tuple'(<pos 27406256 lvl: 0 [0] byte-code tests>, 8)
104 43381584 <type 'list'[]
105 43381624 <type 'tuple'(leoTkTextWidget id: 27572024 name: head-1, 4)
106 43381824 <type 'tuple'(<pos 27406096 lvl: 0 [0] gc.get_objects>, 8)
107 43382024 <type 'tuple'(leoTkTextWidget id: 25543704 name: head-4, 19)
108 43382224 <type 'tuple'(<pos 27406320 lvl: 0 [0] getNewObjects>, 8)
109 43382424 <type 'tuple'(<pos 43384912 lvl: 1 [0] isLargeItem>, 8)
110 43382704 <type 'tuple'(leoTkTextWidget id: 27572424 name: head-5, 23)
111 43382824 <type 'list'[]
112 43382864 <type 'tuple'(leoTkTextWidget id: 27627608 name: head-12, 54)
113 43383384 <type 'tuple'***** large item
114 43384912 <class 'leoNodes.position'<pos 43384912 lvl: 1 [0]
isLargeItem>
115 43425840 <type 'function'<function callit at 0x0296A030>
116 43426032 <type 'function'<function isLargeItem at 0x0296A0F0>
117 43426224 <type 'tuple'(None, <code object isLargeItem at 0296A160,
file "C:\prog\tigris-cvs\leo\test\scriptFile.py", line 7>
, '----- %d new objects', 200, 0, 1, '%3d', '***** large item', '=====')
118 43442512 <type 'dict'***** large item
=====

I think this answers the question about where the strings are: they are
enclosed in tuples. My guess is that the tuples are the way that Python's
bytecode accesses the strings. For example, there is a LOAD_CONST i
bytecode whose argument i is an index into the stack frame (or is it the
code objects). Anyway, my guess is that strings seldom (never?) exist
outside the tuple by which they are referenced. So I think this answers the
mystery, mostly.

Edward
--------------------------------------------------------------------
Edward K. Ream email: ed*******@charter.net
Leo: http://webpages.charter.net/edreamleo/front.html
--------------------------------------------------------------------
May 4 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
by: Ravi | last post by:
Hi, I have about 200GB of data that I need to go through and extract the common first part of a line. Something like this. >>>a = "abcdefghijklmnopqrstuvwxyz" >>>b = "abcdefghijklmnopBHLHT"...
2
by: Nat | last post by:
Hi there, I have code as following but it returns error Error Type: Microsoft VBScript compilation (0x800A03F6) Expected 'End' /urbisjhdintranet/metadata/resultList.asp, line 324 which is the...
2
by: Robert Zientara | last post by:
Sorry for asking stupid questions... I can't remember which settings in MS SQL define the behaviour of this comparison: select * from table where 'Anna ' = 'Anna' to be TRUE. Both strings...
13
by: Thomas Zhu | last post by:
Hello, I know the difference between the two definations. But I do not know where are they in the memory. would someone tell me ? char s={"good", "morning"}; // at stack? char *t = {"good",...
5
by: Simon Harvey | last post by:
Hi everyone, As I understand it, storing an applications SQL Server connection string in the web.config file is a security risk. I'm wondering then, what the simplest solution is to this...
5
by: Darrel | last post by:
I've been taught that, at least in 1.1, you put your DB connection strings in the WebConfig file and access them from there as needed. In 2.0, it looks like I can do the same, but it's been...
2
by: Potiuper | last post by:
Question: Is it possible to use a char pointer array ( char *<name> ) to read an array of strings from a file in C? Given: code is written in ANSI C; I know the exact nature of the strings to be...
0
NeoPa
by: NeoPa | last post by:
Background Whenever code is used there must be a way to differentiate the actual code (which should be interpreted directly) with literal strings which should be interpreted as data. Numbers don't...
3
by: crazy420fingers | last post by:
I'm running a python program that simulates a wireless network protocol for a certain number of "frames" (measure of time). I've observed the following: 1. The memory consumption of the program...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.