# New Ticket Created by chromatic # Please include the string: [perl #48365] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=48365 >
Test #9 in t/oo/new.t consumes ever-increasing amounts of memory for me. I ran it in the debugger, caused a segfault, and stopped the backtrace at: #17283 0xb7e39340 in Parrot_Key_get_string (interp=0x804f008, pmc=0x8262790) at ./src/pmc/key.pmc:146 #17284 0xb7d0b741 in key_string (interp=0x804f008, key=0x8262790) at src/key.c:442 #17285 0xb7e39340 in Parrot_Key_get_string (interp=0x804f008, pmc=0x8262790) at ./src/pmc/key.pmc:146 #17286 0xb7d0b741 in key_string (interp=0x804f008, key=0x8262790) ---Type <return> to continue, or q <return> to quit---q at src/key.c:4Quit Let's call that an infinite loop. The get_string vtable entry is pretty simple: STRING *get_string() { return key_string(INTERP, SELF); } Here's the punchline in key_string (src/key.c): switch (PObj_get_FLAGS(key) & KEY_type_FLAGS) { /* ... code elided for explanation ... */ default: case KEY_pmc_FLAG: return VTABLE_get_string(interp, key); } That's right, there's an infinite loop here for Key PMCs with no flags set. How do I know there are no flags set? Look at the initializer: void init() { PObj_custom_mark_SET(SELF); } It should never be possible to wedge Parrot into an infinite loop without explicitly coding an infinite loop yourself, so we need to fix this. One solution is to fix the switch statement so that the default behavior is to return an empty string. Another solution is to set a default value in the initializer. Are there other options? -- c