[perl #43218] Memory leaks (compreg, invokecc)

Will Coleda via RT parrotbug-followup at parrotcode.org
Wed Dec 3 20:27:27 UTC 2008


On Wed Jul 23 05:28:49 2008, mj41.cz at gmail.com wrote:
> Christoph Otto via RT napsal(a):
> 
> Is this something we're still concerned about or can this ticket be 
closed?
> 
> 
> If it isn't leak then it is a bug (in Parrot or in my PIR/PASM code). 
I
> can invoke PASM compiler 10^5x (76MB RAM) but not 10^7x because I get
> 
> Parrot VM: PANIC: Out of mem!
> C file src\gc\memory.c, line 137
> Parrot file (not available), line (not available)
> 
> We highly suggest you notify the Parrot team ...
> 
> Version     : 0.6.4-devel
> Configured  : Wed Jul 23 10:28:04 2008 GMT
> Architecture: i386-MSWin32
> JIT Capable : Yes
> Interp Flags: (no interpreter)
> Exceptions  : (missing from core)
> 
> I wrote new test in PIR "bad-int-t4.pir"
> (
> http://mj41.cz/down/Parrot/tests-bugs-etc/02-
probably%20memory%20leaks/
> or attached ).
> 

Using the original PASM sample (but chopping the # of iterations down to 
100) and running it through valgrind with parrot r33458, I get:

==21596== Memcheck, a memory error detector.
==21596== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et 
al.
==21596== Using LibVEX rev 1854, a library for dynamic binary 
translation.
==21596== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==21596== Using valgrind-3.3.1-Debian, a dynamic binary instrumentation 
framework.
==21596== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et 
al.
==21596== For more details, rerun with: -v
==21596==
==21596==
==21596== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 51 from 
1)
==21596== malloc/free: in use at exit: 3,712 bytes in 416 blocks.
==21596== malloc/free: 15,310 allocs, 14,894 frees, 14,592,028 bytes 
allocated.
==21596== For counts of detected errors, rerun with: -v
==21596== searching for pointers to 416 not-freed blocks.
==21596== checked 809,180 bytes.
==21596==
==21596== 112 bytes in 16 blocks are definitely lost in loss record 1 of 
2
==21596==    at 0x4023D6E: malloc (vg_replace_malloc.c:207)
==21596==    by 0x421311C: mem_sys_allocate (memory.c:46)
==21596==    by 0x42578DD: str_dup (string_primitives.c:350)
==21596==    by 0x44F2162: yylex (imcc.l:644)
==21596==    by 0x44EA6BB: yyparse (imcparser.c:2810)
==21596==    by 0x44F7FBB: compile_to_bytecode (main.c:950)
==21596==    by 0x44F83A1: imcc_run (main.c:1053)
==21596==    by 0x80489A7: main (main.c:61)
==21596==
==21596==
==21596== 3,600 bytes in 400 blocks are definitely lost in loss record 2 
of 2
==21596==    at 0x4023D6E: malloc (vg_replace_malloc.c:207)
==21596==    by 0x421311C: mem_sys_allocate (memory.c:46)
==21596==    by 0x42578DD: str_dup (string_primitives.c:350)
==21596==    by 0x44F2162: yylex (imcc.l:644)
==21596==    by 0x44EA6BB: yyparse (imcparser.c:2810)
==21596==    by 0x44F5FFD: compile_string (imcc.l:1340)
==21596==    by 0x4508959: imcc_compile (parser_util.c:644)
==21596==    by 0x4508BF2: imcc_compile_pasm_ex (parser_util.c:804)
==21596==    by 0x55D3072: ???
==21596==    by 0x43C9B7D: Parrot_NCI_invoke (nci.pmc:311)
==21596==    by 0x4198665: Parrot_invokecc_p (core.ops:479)
==21596==    by 0x424F86B: runops_slow_core (runops_cores.c:222)
==21596==    by 0x4220058: runops_int (interpreter.c:938)
==21596==    by 0x4220932: runops (inter_run.c:103)
==21596==    by 0x4220BF0: runops_args (inter_run.c:240)
==21596==    by 0x4220D2B: Parrot_runops_fromc_args (inter_run.c:305)
==21596==    by 0x42065D6: Parrot_runcode (embed.c:959)
==21596==    by 0x44F7A17: imcc_run_pbc (main.c:790)
==21596==    by 0x44F84E4: imcc_run (main.c:1078)
==21596==    by 0x80489A7: main (main.c:61)
==21596==
==21596== LEAK SUMMARY:
==21596==    definitely lost: 3,712 bytes in 416 blocks.
==21596==      possibly lost: 0 bytes in 0 blocks.
==21596==    still reachable: 0 bytes in 0 blocks.
==21596==         suppressed: 0 bytes in 0 blocks.


Running it through the original # of iterations loses even more, but I 
lost the full output of this valgrind run.

==18592== LEAK SUMMARY:
==18592==    definitely lost: 3,599,987 bytes in 400,004 blocks.
==18592==      possibly lost: 98 bytes in 9 blocks.
==18592==    still reachable: 27 bytes in 3 blocks.
==18592==         suppressed: 0 bytes in 0 blocks.

-- 
Will "Coke" Coleda


More information about the parrot-dev mailing list