Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Valgrind reports invalid free() / delete / delete [] running node.js on empty file #222

Closed
pkrumins opened this issue Jul 29, 2010 · 2 comments

Comments

@pkrumins
Copy link

Create an 'empty.js' file and run node through valgrind on it.

Valgrind detects invalid free() / delete / delete []:

$ valgrind node empty.js
==24757== Memcheck, a memory error detector
==24757== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al.
==24757== Using Valgrind-3.5.0-Debian and LibVEX; rerun with -h for copyright info
==24757== Command: node empty.js
==24757== 
==24757== Invalid free() / delete / delete[]
==24757==    at 0x4024866: free (vg_replace_malloc.c:325)
==24757==    by 0x44B55DB: ??? (in /lib/i686/cmov/libc-2.10.2.so)
==24757==    by 0x44B50B9: ??? (in /lib/i686/cmov/libc-2.10.2.so)
==24757==    by 0x4020412: _vgnU_freeres (vg_preloaded.c:62)
==24757==    by 0x443FA43: _Exit (_exit.S:30)
==24757==    by 0x43D54DE: exit (exit.c:100)
==24757==    by 0x43BCB5C: (below main) (libc-start.c:254)
==24757==  Address 0x4258dc0 is not stack'd, malloc'd or (recently) free'd
==24757== 
==24757== 
==24757== HEAP SUMMARY:
==24757==     in use at exit: 221,969 bytes in 83 blocks
==24757==   total heap usage: 493 allocs, 411 frees, 2,362,905 bytes allocated
==24757== 
==24757== LEAK SUMMARY:
==24757==    definitely lost: 0 bytes in 0 blocks
==24757==    indirectly lost: 0 bytes in 0 blocks
==24757==      possibly lost: 0 bytes in 0 blocks
==24757==    still reachable: 221,969 bytes in 83 blocks
==24757==         suppressed: 0 bytes in 0 blocks
==24757== Rerun with --leak-check=full to see details of leaked memory
==24757== 
==24757== For counts of detected and suppressed errors, rerun with: -v
==24757== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 35 from 8)
@japj
Copy link

japj commented Jun 30, 2011

With node 0.4.8 I get:

japj@viper:~/sandbox/222$ valgrind node empty.js
==24597== Memcheck, a memory error detector
==24597== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==24597== Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info
==24597== Command: node empty.js
==24597==
==24597==
==24597== HEAP SUMMARY:
==24597==     in use at exit: 61,426 bytes in 72 blocks
==24597==   total heap usage: 1,416 allocs, 1,344 frees, 7,082,107 bytes allocated
==24597==
==24597== LEAK SUMMARY:
==24597==    definitely lost: 624 bytes in 40 blocks
==24597==    indirectly lost: 8,192 bytes in 1 blocks
==24597==      possibly lost: 0 bytes in 0 blocks
==24597==    still reachable: 52,610 bytes in 31 blocks
==24597==         suppressed: 0 bytes in 0 blocks
==24597== Rerun with --leak-check=full to see details of leaked memory
==24597==
==24597== For counts of detected and suppressed errors, rerun with: -v
==24597== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 31 from 6)

So there do not seem to be any errors anymore.
Can this issue be closed? Or should we look more into the leaks with --leak-check=full?

@bnoordhuis
Copy link
Member

Confirmed, works fine with master.

@japj The leaks are unrelated to this issue. Cleaning them up would be great (makes debugging real memory leaks a whole lot easier) but it's kind of hard to do due to how object life cycles work in V8.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants