Csound Csound-dev Csound-tekno Search About

[Cs-dev] lua cleanup

Date2013-07-02 00:28
FromAndres Cabrera
Subject[Cs-dev] lua cleanup
AttachmentsNone  None  

Hi,

I'm having trouble with the cleanup of the Lua module when the application exits and calls the atexit registered function. If I remove the Lua module, there is no problem.

Strangely, testChannels will run fine, but testCsoundTypeSystem will fail:

0    __memmove_ssse3_back        1548    0x7ffff721ba2f   
1    std::__copy_move<false, true, std::random_access_iterator_tag>::__copy_m<LuaStateForThread>    stl_algobase.h    366    0x7fffee7dc3a6   
2    std::__copy_move_a<false, LuaStateForThread*, LuaStateForThread*>    stl_algobase.h    384    0x7fffee7dbaba   
3    std::__copy_move_a2<false, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > >    stl_algobase.h    422    0x7fffee7da897   
4    std::copy<__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > >    stl_algobase.h    454    0x7fffee7d972b   
5    std::vector<LuaStateForThread, std::allocator<LuaStateForThread> >::erase    vector.tcc    139    0x7fffee7d86a0   
6    manageLuaState    LuaCsound.cpp    168    0x7fffee7d6b5e   
7    csoundModuleDestroy    LuaCsound.cpp    738    0x7fffee7d6cd4   
8    csoundDestroyModules    csmodule.c    637    0x7ffff7a67b0f   
9    reset    csound.c    2616    0x7ffff7a6b8e7   
10    csoundDestroy    csound.c    1192    0x7ffff7a685a2   
11    destroy_all_instances    csound.c    888    0x7ffff7a6824f   
12    __run_exit_handlers        77    0x7ffff7102121   
13    __GI_exit        99    0x7ffff71021a5   
14    __libc_start_main        294    0x7ffff70e7eac   
15    _start            0x400cb9   


valgrind reports:

~/Documents/src/csound-csound6-git-build/tests/c $
andres@andres-ThinkPad-W530 ~/Documents/src/csound-csound6-git-build/tests/c $ valgrind ./testCsoundTypeSystem
==20546== Memcheck, a memory error detector
==20546== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==20546== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==20546== Command: ./testCsoundTypeSystem
==20546==


     CUnit - A Unit testing framework for C - Version 2.1-0
     http://cunit.sourceforge.net/


Suite: Type System Tests
  Test: Test Type System ... virtual_keyboard real time MIDI plugin for Csound
0dBFS level = 32768.0
Csound version 6.00 (double samples) Jul  1 2013
libsndfile-1.0.25
passed
  Test: Test getVarSimpleName ... virtual_keyboard real time MIDI plugin for Csound
0dBFS level = 32768.0
Csound version 6.00 (double samples) Jul  1 2013
libsndfile-1.0.25
passed

--Run Summary: Type      Total     Ran  Passed  Failed
               suites        1       1     n/a       0
               tests         2       2       2       0
               asserts       9       9       9       0
end of score.           overall amps:      0.0
       overall samples out of range:        0
0 errors in performance
Elapsed time at end of performance: real: 0.294s, CPU: 0.050s
==20546== Invalid read of size 8
==20546==    at 0xE63A94A: operator==(LuaStateForThread const&, LuaStateForThread const&) (LuaCsound.cpp:122)
==20546==    by 0xE63D345: __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > std::__find<__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, LuaStateForThread>(__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, LuaStateForThread const&, std::random_access_iterator_tag) (stl_algo.h:190)
==20546==    by 0xE63C4F9: __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > std::find<__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, LuaStateForThread>(__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, LuaStateForThread const&) (stl_algo.h:4466)
==20546==    by 0xE63AA1D: manageLuaState(char) (LuaCsound.cpp:143)
==20546==    by 0xE63ACD3: csoundModuleDestroy (LuaCsound.cpp:738)
==20546==    by 0x4FE4B0E: csoundDestroyModules (csmodule.c:637)
==20546==    by 0x4FE88E6: reset (csound.c:2616)
==20546==    by 0x4FE55A1: csoundDestroy (csound.c:1192)
==20546==    by 0x4FE524E: destroy_all_instances (csound.c:888)
==20546==    by 0x57BC120: __run_exit_handlers (exit.c:77)
==20546==    by 0x57BC1A4: exit (exit.c:99)
==20546==    by 0x57A1EAB: (below main) (libc-start.c:294)
==20546==  Address 0x6f59730 is 0 bytes inside a block of size 16 free'd
==20546==    at 0x4C2B59C: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==20546==    by 0xE63F8F5: __gnu_cxx::new_allocator<LuaStateForThread>::deallocate(LuaStateForThread*, unsigned long) (new_allocator.h:100)
==20546==    by 0xE63E5CB: std::_Vector_base<LuaStateForThread, std::allocator<LuaStateForThread> >::_M_deallocate(LuaStateForThread*, unsigned long) (stl_vector.h:175)
==20546==    by 0xE63D0F8: std::_Vector_base<LuaStateForThread, std::allocator<LuaStateForThread> >::~_Vector_base() (stl_vector.h:161)
==20546==    by 0xE63C44B: std::vector<LuaStateForThread, std::allocator<LuaStateForThread> >::~vector() (stl_vector.h:404)
==20546==    by 0x57BC120: __run_exit_handlers (exit.c:77)
==20546==    by 0x57BC1A4: exit (exit.c:99)
==20546==    by 0x57A1EAB: (below main) (libc-start.c:294)
==20546==
==20546== Invalid read of size 8
==20546==    at 0xE63AB07: manageLuaState(char) (LuaCsound.cpp:165)
==20546==    by 0xE63ACD3: csoundModuleDestroy (LuaCsound.cpp:738)
==20546==    by 0x4FE4B0E: csoundDestroyModules (csmodule.c:637)
==20546==    by 0x4FE88E6: reset (csound.c:2616)
==20546==    by 0x4FE55A1: csoundDestroy (csound.c:1192)
==20546==    by 0x4FE524E: destroy_all_instances (csound.c:888)
==20546==    by 0x57BC120: __run_exit_handlers (exit.c:77)
==20546==    by 0x57BC1A4: exit (exit.c:99)
==20546==    by 0x57A1EAB: (below main) (libc-start.c:294)
==20546==  Address 0x6f59738 is 8 bytes inside a block of size 16 free'd
==20546==    at 0x4C2B59C: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==20546==    by 0xE63F8F5: __gnu_cxx::new_allocator<LuaStateForThread>::deallocate(LuaStateForThread*, unsigned long) (new_allocator.h:100)
==20546==    by 0xE63E5CB: std::_Vector_base<LuaStateForThread, std::allocator<LuaStateForThread> >::_M_deallocate(LuaStateForThread*, unsigned long) (stl_vector.h:175)
==20546==    by 0xE63D0F8: std::_Vector_base<LuaStateForThread, std::allocator<LuaStateForThread> >::~_Vector_base() (stl_vector.h:161)
==20546==    by 0xE63C44B: std::vector<LuaStateForThread, std::allocator<LuaStateForThread> >::~vector() (stl_vector.h:404)
==20546==    by 0x57BC120: __run_exit_handlers (exit.c:77)
==20546==    by 0x57BC1A4: exit (exit.c:99)
==20546==    by 0x57A1EAB: (below main) (libc-start.c:294)
==20546==
==20546== Invalid read of size 8
==20546==    at 0xE63AB43: manageLuaState(char) (LuaCsound.cpp:166)
==20546==    by 0xE63ACD3: csoundModuleDestroy (LuaCsound.cpp:738)
==20546==    by 0x4FE4B0E: csoundDestroyModules (csmodule.c:637)
==20546==    by 0x4FE88E6: reset (csound.c:2616)
==20546==    by 0x4FE55A1: csoundDestroy (csound.c:1192)
==20546==    by 0x4FE524E: destroy_all_instances (csound.c:888)
==20546==    by 0x57BC120: __run_exit_handlers (exit.c:77)
==20546==    by 0x57BC1A4: exit (exit.c:99)
==20546==    by 0x57A1EAB: (below main) (libc-start.c:294)
==20546==  Address 0x6f59738 is 8 bytes inside a block of size 16 free'd
==20546==    at 0x4C2B59C: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==20546==    by 0xE63F8F5: __gnu_cxx::new_allocator<LuaStateForThread>::deallocate(LuaStateForThread*, unsigned long) (new_allocator.h:100)
==20546==    by 0xE63E5CB: std::_Vector_base<LuaStateForThread, std::allocator<LuaStateForThread> >::_M_deallocate(LuaStateForThread*, unsigned long) (stl_vector.h:175)
==20546==    by 0xE63D0F8: std::_Vector_base<LuaStateForThread, std::allocator<LuaStateForThread> >::~_Vector_base() (stl_vector.h:161)
==20546==    by 0xE63C44B: std::vector<LuaStateForThread, std::allocator<LuaStateForThread> >::~vector() (stl_vector.h:404)
==20546==    by 0x57BC120: __run_exit_handlers (exit.c:77)
==20546==    by 0x57BC1A4: exit (exit.c:99)
==20546==    by 0x57A1EAB: (below main) (libc-start.c:294)
==20546==
end of score.           overall amps:      0.0
       overall samples out of range:        0
0 errors in performance
Elapsed time at end of performance: real: 0.653s, CPU: 0.400s
==20546== Invalid read of size 8
==20546==    at 0x4C2E610: memcpy@GLIBC_2.2.5 (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==20546==    by 0xE6403A5: LuaStateForThread* std::__copy_move<false, true, std::random_access_iterator_tag>::__copy_m<LuaStateForThread>(LuaStateForThread const*, LuaStateForThread const*, LuaStateForThread*) (stl_algobase.h:366)
==20546==    by 0xE63FAB9: LuaStateForThread* std::__copy_move_a<false, LuaStateForThread*, LuaStateForThread*>(LuaStateForThread*, LuaStateForThread*, LuaStateForThread*) (stl_algobase.h:384)
==20546==    by 0xE63E896: __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > std::__copy_move_a2<false, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > >(__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >) (stl_algobase.h:422)
==20546==    by 0xE63D72A: __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > std::copy<__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > >(__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >) (stl_algobase.h:454)
==20546==    by 0xE63C69F: std::vector<LuaStateForThread, std::allocator<LuaStateForThread> >::erase(__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >) (vector.tcc:139)
==20546==    by 0xE63AB5D: manageLuaState(char) (LuaCsound.cpp:168)
==20546==    by 0xE63ACD3: csoundModuleDestroy (LuaCsound.cpp:738)
==20546==    by 0x4FE4B0E: csoundDestroyModules (csmodule.c:637)
==20546==    by 0x4FE88E6: reset (csound.c:2616)
==20546==    by 0x4FE55A1: csoundDestroy (csound.c:1192)
==20546==    by 0x4FE524E: destroy_all_instances (csound.c:888)
==20546==  Address 0x6f59740 is 0 bytes after a block of size 16 free'd
==20546==    at 0x4C2B59C: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==20546==    by 0xE63F8F5: __gnu_cxx::new_allocator<LuaStateForThread>::deallocate(LuaStateForThread*, unsigned long) (new_allocator.h:100)
==20546==    by 0xE63E5CB: std::_Vector_base<LuaStateForThread, std::allocator<LuaStateForThread> >::_M_deallocate(LuaStateForThread*, unsigned long) (stl_vector.h:175)
==20546==    by 0xE63D0F8: std::_Vector_base<LuaStateForThread, std::allocator<LuaStateForThread> >::~_Vector_base() (stl_vector.h:161)
==20546==    by 0xE63C44B: std::vector<LuaStateForThread, std::allocator<LuaStateForThread> >::~vector() (stl_vector.h:404)
==20546==    by 0x57BC120: __run_exit_handlers (exit.c:77)
==20546==    by 0x57BC1A4: exit (exit.c:99)
==20546==    by 0x57A1EAB: (below main) (libc-start.c:294)
==20546==
==20546== Invalid write of size 8
==20546==    at 0x4C2E613: memcpy@GLIBC_2.2.5 (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==20546==    by 0xE6403A5: LuaStateForThread* std::__copy_move<false, true, std::random_access_iterator_tag>::__copy_m<LuaStateForThread>(LuaStateForThread const*, LuaStateForThread const*, LuaStateForThread*) (stl_algobase.h:366)
==20546==    by 0xE63FAB9: LuaStateForThread* std::__copy_move_a<false, LuaStateForThread*, LuaStateForThread*>(LuaStateForThread*, LuaStateForThread*, LuaStateForThread*) (stl_algobase.h:384)
==20546==    by 0xE63E896: __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > std::__copy_move_a2<false, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > >(__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >) (stl_algobase.h:422)
==20546==    by 0xE63D72A: __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > std::copy<__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > >(__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >) (stl_algobase.h:454)
==20546==    by 0xE63C69F: std::vector<LuaStateForThread, std::allocator<LuaStateForThread> >::erase(__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >) (vector.tcc:139)
==20546==    by 0xE63AB5D: manageLuaState(char) (LuaCsound.cpp:168)
==20546==    by 0xE63ACD3: csoundModuleDestroy (LuaCsound.cpp:738)
==20546==    by 0x4FE4B0E: csoundDestroyModules (csmodule.c:637)
==20546==    by 0x4FE88E6: reset (csound.c:2616)
==20546==    by 0x4FE55A1: csoundDestroy (csound.c:1192)
==20546==    by 0x4FE524E: destroy_all_instances (csound.c:888)
==20546==  Address 0x6f59730 is 0 bytes inside a block of size 16 free'd
==20546==    at 0x4C2B59C: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==20546==    by 0xE63F8F5: __gnu_cxx::new_allocator<LuaStateForThread>::deallocate(LuaStateForThread*, unsigned long) (new_allocator.h:100)
==20546==    by 0xE63E5CB: std::_Vector_base<LuaStateForThread, std::allocator<LuaStateForThread> >::_M_deallocate(LuaStateForThread*, unsigned long) (stl_vector.h:175)
==20546==    by 0xE63D0F8: std::_Vector_base<LuaStateForThread, std::allocator<LuaStateForThread> >::~_Vector_base() (stl_vector.h:161)
==20546==    by 0xE63C44B: std::vector<LuaStateForThread, std::allocator<LuaStateForThread> >::~vector() (stl_vector.h:404)
==20546==    by 0x57BC120: __run_exit_handlers (exit.c:77)
==20546==    by 0x57BC1A4: exit (exit.c:99)
==20546==    by 0x57A1EAB: (below main) (libc-start.c:294)
==20546==
==20546== Invalid read of size 8
==20546==    at 0x4C2E61E: memcpy@GLIBC_2.2.5 (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==20546==    by 0xE6403A5: LuaStateForThread* std::__copy_move<false, true, std::random_access_iterator_tag>::__copy_m<LuaStateForThread>(LuaStateForThread const*, LuaStateForThread const*, LuaStateForThread*) (stl_algobase.h:366)
==20546==    by 0xE63FAB9: LuaStateForThread* std::__copy_move_a<false, LuaStateForThread*, LuaStateForThread*>(LuaStateForThread*, LuaStateForThread*, LuaStateForThread*) (stl_algobase.h:384)
==20546==    by 0xE63E896: __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > std::__copy_move_a2<false, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > >(__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >) (stl_algobase.h:422)
==20546==    by 0xE63D72A: __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > std::copy<__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > >(__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >) (stl_algobase.h:454)
==20546==    by 0xE63C69F: std::vector<LuaStateForThread, std::allocator<LuaStateForThread> >::erase(__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >) (vector.tcc:139)
==20546==    by 0xE63AB5D: manageLuaState(char) (LuaCsound.cpp:168)
==20546==    by 0xE63ACD3: csoundModuleDestroy (LuaCsound.cpp:738)
==20546==    by 0x4FE4B0E: csoundDestroyModules (csmodule.c:637)
==20546==    by 0x4FE88E6: reset (csound.c:2616)
==20546==    by 0x4FE55A1: csoundDestroy (csound.c:1192)
==20546==    by 0x4FE524E: destroy_all_instances (csound.c:888)
==20546==  Address 0x6f59750 is 16 bytes after a block of size 16 free'd
==20546==    at 0x4C2B59C: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==20546==    by 0xE63F8F5: __gnu_cxx::new_allocator<LuaStateForThread>::deallocate(LuaStateForThread*, unsigned long) (new_allocator.h:100)
==20546==    by 0xE63E5CB: std::_Vector_base<LuaStateForThread, std::allocator<LuaStateForThread> >::_M_deallocate(LuaStateForThread*, unsigned long) (stl_vector.h:175)
==20546==    by 0xE63D0F8: std::_Vector_base<LuaStateForThread, std::allocator<LuaStateForThread> >::~_Vector_base() (stl_vector.h:161)
==20546==    by 0xE63C44B: std::vector<LuaStateForThread, std::allocator<LuaStateForThread> >::~vector() (stl_vector.h:404)
==20546==    by 0x57BC120: __run_exit_handlers (exit.c:77)
==20546==    by 0x57BC1A4: exit (exit.c:99)
==20546==    by 0x57A1EAB: (below main) (libc-start.c:294)
==20546==
Csound tidy up: Segmentation fault
==20546==
==20546== HEAP SUMMARY:
==20546==     in use at exit: 828,250 bytes in 7,975 blocks
==20546==   total heap usage: 17,113 allocs, 9,138 frees, 1,827,395 bytes allocated
==20546==
==20546== LEAK SUMMARY:
==20546==    definitely lost: 616 bytes in 1 blocks
==20546==    indirectly lost: 26,097 bytes in 386 blocks
==20546==      possibly lost: 625,242 bytes in 7,261 blocks
==20546==    still reachable: 176,295 bytes in 327 blocks
==20546==         suppressed: 0 bytes in 0 blocks
==20546== Rerun with --leak-check=full to see details of leaked memory
==20546==
==20546== For counts of detected and suppressed errors, rerun with: -v
==20546== ERROR SUMMARY: 681931 errors from 6 contexts (suppressed: 2 from 2)

Cheers,
Andrés

Date2013-07-02 22:46
FromAndres Cabrera
SubjectRe: [Cs-dev] lua cleanup
AttachmentsNone  None  
Hi,

Is it just me having this issue?

Cheers,
Andrés


On Mon, Jul 1, 2013 at 4:28 PM, Andres Cabrera <mantaraya36@gmail.com> wrote:

Hi,

I'm having trouble with the cleanup of the Lua module when the application exits and calls the atexit registered function. If I remove the Lua module, there is no problem.

Strangely, testChannels will run fine, but testCsoundTypeSystem will fail:

0    __memmove_ssse3_back        1548    0x7ffff721ba2f   
1    std::__copy_move<false, true, std::random_access_iterator_tag>::__copy_m<LuaStateForThread>    stl_algobase.h    366    0x7fffee7dc3a6   
2    std::__copy_move_a<false, LuaStateForThread*, LuaStateForThread*>    stl_algobase.h    384    0x7fffee7dbaba   
3    std::__copy_move_a2<false, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > >    stl_algobase.h    422    0x7fffee7da897   
4    std::copy<__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > >    stl_algobase.h    454    0x7fffee7d972b   
5    std::vector<LuaStateForThread, std::allocator<LuaStateForThread> >::erase    vector.tcc    139    0x7fffee7d86a0   
6    manageLuaState    LuaCsound.cpp    168    0x7fffee7d6b5e   
7    csoundModuleDestroy    LuaCsound.cpp    738    0x7fffee7d6cd4   
8    csoundDestroyModules    csmodule.c    637    0x7ffff7a67b0f   
9    reset    csound.c    2616    0x7ffff7a6b8e7   
10    csoundDestroy    csound.c    1192    0x7ffff7a685a2   
11    destroy_all_instances    csound.c    888    0x7ffff7a6824f   
12    __run_exit_handlers        77    0x7ffff7102121   
13    __GI_exit        99    0x7ffff71021a5   
14    __libc_start_main        294    0x7ffff70e7eac   
15    _start            0x400cb9   


valgrind reports:

~/Documents/src/csound-csound6-git-build/tests/c $
andres@andres-ThinkPad-W530 ~/Documents/src/csound-csound6-git-build/tests/c $ valgrind ./testCsoundTypeSystem
==20546== Memcheck, a memory error detector
==20546== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==20546== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==20546== Command: ./testCsoundTypeSystem
==20546==


     CUnit - A Unit testing framework for C - Version 2.1-0
     http://cunit.sourceforge.net/


Suite: Type System Tests
  Test: Test Type System ... virtual_keyboard real time MIDI plugin for Csound
0dBFS level = 32768.0
Csound version 6.00 (double samples) Jul  1 2013
libsndfile-1.0.25
passed
  Test: Test getVarSimpleName ... virtual_keyboard real time MIDI plugin for Csound
0dBFS level = 32768.0
Csound version 6.00 (double samples) Jul  1 2013
libsndfile-1.0.25
passed

--Run Summary: Type      Total     Ran  Passed  Failed
               suites        1       1     n/a       0
               tests         2       2       2       0
               asserts       9       9       9       0
end of score.           overall amps:      0.0
       overall samples out of range:        0
0 errors in performance
Elapsed time at end of performance: real: 0.294s, CPU: 0.050s
==20546== Invalid read of size 8
==20546==    at 0xE63A94A: operator==(LuaStateForThread const&, LuaStateForThread const&) (LuaCsound.cpp:122)
==20546==    by 0xE63D345: __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > std::__find<__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, LuaStateForThread>(__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, LuaStateForThread const&, std::random_access_iterator_tag) (stl_algo.h:190)
==20546==    by 0xE63C4F9: __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > std::find<__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, LuaStateForThread>(__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, LuaStateForThread const&) (stl_algo.h:4466)
==20546==    by 0xE63AA1D: manageLuaState(char) (LuaCsound.cpp:143)
==20546==    by 0xE63ACD3: csoundModuleDestroy (LuaCsound.cpp:738)
==20546==    by 0x4FE4B0E: csoundDestroyModules (csmodule.c:637)
==20546==    by 0x4FE88E6: reset (csound.c:2616)
==20546==    by 0x4FE55A1: csoundDestroy (csound.c:1192)
==20546==    by 0x4FE524E: destroy_all_instances (csound.c:888)
==20546==    by 0x57BC120: __run_exit_handlers (exit.c:77)
==20546==    by 0x57BC1A4: exit (exit.c:99)
==20546==    by 0x57A1EAB: (below main) (libc-start.c:294)
==20546==  Address 0x6f59730 is 0 bytes inside a block of size 16 free'd
==20546==    at 0x4C2B59C: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==20546==    by 0xE63F8F5: __gnu_cxx::new_allocator<LuaStateForThread>::deallocate(LuaStateForThread*, unsigned long) (new_allocator.h:100)
==20546==    by 0xE63E5CB: std::_Vector_base<LuaStateForThread, std::allocator<LuaStateForThread> >::_M_deallocate(LuaStateForThread*, unsigned long) (stl_vector.h:175)
==20546==    by 0xE63D0F8: std::_Vector_base<LuaStateForThread, std::allocator<LuaStateForThread> >::~_Vector_base() (stl_vector.h:161)
==20546==    by 0xE63C44B: std::vector<LuaStateForThread, std::allocator<LuaStateForThread> >::~vector() (stl_vector.h:404)
==20546==    by 0x57BC120: __run_exit_handlers (exit.c:77)
==20546==    by 0x57BC1A4: exit (exit.c:99)
==20546==    by 0x57A1EAB: (below main) (libc-start.c:294)
==20546==
==20546== Invalid read of size 8
==20546==    at 0xE63AB07: manageLuaState(char) (LuaCsound.cpp:165)
==20546==    by 0xE63ACD3: csoundModuleDestroy (LuaCsound.cpp:738)
==20546==    by 0x4FE4B0E: csoundDestroyModules (csmodule.c:637)
==20546==    by 0x4FE88E6: reset (csound.c:2616)
==20546==    by 0x4FE55A1: csoundDestroy (csound.c:1192)
==20546==    by 0x4FE524E: destroy_all_instances (csound.c:888)
==20546==    by 0x57BC120: __run_exit_handlers (exit.c:77)
==20546==    by 0x57BC1A4: exit (exit.c:99)
==20546==    by 0x57A1EAB: (below main) (libc-start.c:294)
==20546==  Address 0x6f59738 is 8 bytes inside a block of size 16 free'd
==20546==    at 0x4C2B59C: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==20546==    by 0xE63F8F5: __gnu_cxx::new_allocator<LuaStateForThread>::deallocate(LuaStateForThread*, unsigned long) (new_allocator.h:100)
==20546==    by 0xE63E5CB: std::_Vector_base<LuaStateForThread, std::allocator<LuaStateForThread> >::_M_deallocate(LuaStateForThread*, unsigned long) (stl_vector.h:175)
==20546==    by 0xE63D0F8: std::_Vector_base<LuaStateForThread, std::allocator<LuaStateForThread> >::~_Vector_base() (stl_vector.h:161)
==20546==    by 0xE63C44B: std::vector<LuaStateForThread, std::allocator<LuaStateForThread> >::~vector() (stl_vector.h:404)
==20546==    by 0x57BC120: __run_exit_handlers (exit.c:77)
==20546==    by 0x57BC1A4: exit (exit.c:99)
==20546==    by 0x57A1EAB: (below main) (libc-start.c:294)
==20546==
==20546== Invalid read of size 8
==20546==    at 0xE63AB43: manageLuaState(char) (LuaCsound.cpp:166)
==20546==    by 0xE63ACD3: csoundModuleDestroy (LuaCsound.cpp:738)
==20546==    by 0x4FE4B0E: csoundDestroyModules (csmodule.c:637)
==20546==    by 0x4FE88E6: reset (csound.c:2616)
==20546==    by 0x4FE55A1: csoundDestroy (csound.c:1192)
==20546==    by 0x4FE524E: destroy_all_instances (csound.c:888)
==20546==    by 0x57BC120: __run_exit_handlers (exit.c:77)
==20546==    by 0x57BC1A4: exit (exit.c:99)
==20546==    by 0x57A1EAB: (below main) (libc-start.c:294)
==20546==  Address 0x6f59738 is 8 bytes inside a block of size 16 free'd
==20546==    at 0x4C2B59C: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==20546==    by 0xE63F8F5: __gnu_cxx::new_allocator<LuaStateForThread>::deallocate(LuaStateForThread*, unsigned long) (new_allocator.h:100)
==20546==    by 0xE63E5CB: std::_Vector_base<LuaStateForThread, std::allocator<LuaStateForThread> >::_M_deallocate(LuaStateForThread*, unsigned long) (stl_vector.h:175)
==20546==    by 0xE63D0F8: std::_Vector_base<LuaStateForThread, std::allocator<LuaStateForThread> >::~_Vector_base() (stl_vector.h:161)
==20546==    by 0xE63C44B: std::vector<LuaStateForThread, std::allocator<LuaStateForThread> >::~vector() (stl_vector.h:404)
==20546==    by 0x57BC120: __run_exit_handlers (exit.c:77)
==20546==    by 0x57BC1A4: exit (exit.c:99)
==20546==    by 0x57A1EAB: (below main) (libc-start.c:294)
==20546==
end of score.           overall amps:      0.0
       overall samples out of range:        0
0 errors in performance
Elapsed time at end of performance: real: 0.653s, CPU: 0.400s
==20546== Invalid read of size 8
==20546==    at 0x4C2E610: memcpy@GLIBC_2.2.5 (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==20546==    by 0xE6403A5: LuaStateForThread* std::__copy_move<false, true, std::random_access_iterator_tag>::__copy_m<LuaStateForThread>(LuaStateForThread const*, LuaStateForThread const*, LuaStateForThread*) (stl_algobase.h:366)
==20546==    by 0xE63FAB9: LuaStateForThread* std::__copy_move_a<false, LuaStateForThread*, LuaStateForThread*>(LuaStateForThread*, LuaStateForThread*, LuaStateForThread*) (stl_algobase.h:384)
==20546==    by 0xE63E896: __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > std::__copy_move_a2<false, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > >(__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >) (stl_algobase.h:422)
==20546==    by 0xE63D72A: __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > std::copy<__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > >(__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >) (stl_algobase.h:454)
==20546==    by 0xE63C69F: std::vector<LuaStateForThread, std::allocator<LuaStateForThread> >::erase(__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >) (vector.tcc:139)
==20546==    by 0xE63AB5D: manageLuaState(char) (LuaCsound.cpp:168)
==20546==    by 0xE63ACD3: csoundModuleDestroy (LuaCsound.cpp:738)
==20546==    by 0x4FE4B0E: csoundDestroyModules (csmodule.c:637)
==20546==    by 0x4FE88E6: reset (csound.c:2616)
==20546==    by 0x4FE55A1: csoundDestroy (csound.c:1192)
==20546==    by 0x4FE524E: destroy_all_instances (csound.c:888)
==20546==  Address 0x6f59740 is 0 bytes after a block of size 16 free'd
==20546==    at 0x4C2B59C: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==20546==    by 0xE63F8F5: __gnu_cxx::new_allocator<LuaStateForThread>::deallocate(LuaStateForThread*, unsigned long) (new_allocator.h:100)
==20546==    by 0xE63E5CB: std::_Vector_base<LuaStateForThread, std::allocator<LuaStateForThread> >::_M_deallocate(LuaStateForThread*, unsigned long) (stl_vector.h:175)
==20546==    by 0xE63D0F8: std::_Vector_base<LuaStateForThread, std::allocator<LuaStateForThread> >::~_Vector_base() (stl_vector.h:161)
==20546==    by 0xE63C44B: std::vector<LuaStateForThread, std::allocator<LuaStateForThread> >::~vector() (stl_vector.h:404)
==20546==    by 0x57BC120: __run_exit_handlers (exit.c:77)
==20546==    by 0x57BC1A4: exit (exit.c:99)
==20546==    by 0x57A1EAB: (below main) (libc-start.c:294)
==20546==
==20546== Invalid write of size 8
==20546==    at 0x4C2E613: memcpy@GLIBC_2.2.5 (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==20546==    by 0xE6403A5: LuaStateForThread* std::__copy_move<false, true, std::random_access_iterator_tag>::__copy_m<LuaStateForThread>(LuaStateForThread const*, LuaStateForThread const*, LuaStateForThread*) (stl_algobase.h:366)
==20546==    by 0xE63FAB9: LuaStateForThread* std::__copy_move_a<false, LuaStateForThread*, LuaStateForThread*>(LuaStateForThread*, LuaStateForThread*, LuaStateForThread*) (stl_algobase.h:384)
==20546==    by 0xE63E896: __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > std::__copy_move_a2<false, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > >(__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >) (stl_algobase.h:422)
==20546==    by 0xE63D72A: __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > std::copy<__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > >(__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >) (stl_algobase.h:454)
==20546==    by 0xE63C69F: std::vector<LuaStateForThread, std::allocator<LuaStateForThread> >::erase(__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >) (vector.tcc:139)
==20546==    by 0xE63AB5D: manageLuaState(char) (LuaCsound.cpp:168)
==20546==    by 0xE63ACD3: csoundModuleDestroy (LuaCsound.cpp:738)
==20546==    by 0x4FE4B0E: csoundDestroyModules (csmodule.c:637)
==20546==    by 0x4FE88E6: reset (csound.c:2616)
==20546==    by 0x4FE55A1: csoundDestroy (csound.c:1192)
==20546==    by 0x4FE524E: destroy_all_instances (csound.c:888)
==20546==  Address 0x6f59730 is 0 bytes inside a block of size 16 free'd
==20546==    at 0x4C2B59C: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==20546==    by 0xE63F8F5: __gnu_cxx::new_allocator<LuaStateForThread>::deallocate(LuaStateForThread*, unsigned long) (new_allocator.h:100)
==20546==    by 0xE63E5CB: std::_Vector_base<LuaStateForThread, std::allocator<LuaStateForThread> >::_M_deallocate(LuaStateForThread*, unsigned long) (stl_vector.h:175)
==20546==    by 0xE63D0F8: std::_Vector_base<LuaStateForThread, std::allocator<LuaStateForThread> >::~_Vector_base() (stl_vector.h:161)
==20546==    by 0xE63C44B: std::vector<LuaStateForThread, std::allocator<LuaStateForThread> >::~vector() (stl_vector.h:404)
==20546==    by 0x57BC120: __run_exit_handlers (exit.c:77)
==20546==    by 0x57BC1A4: exit (exit.c:99)
==20546==    by 0x57A1EAB: (below main) (libc-start.c:294)
==20546==
==20546== Invalid read of size 8
==20546==    at 0x4C2E61E: memcpy@GLIBC_2.2.5 (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==20546==    by 0xE6403A5: LuaStateForThread* std::__copy_move<false, true, std::random_access_iterator_tag>::__copy_m<LuaStateForThread>(LuaStateForThread const*, LuaStateForThread const*, LuaStateForThread*) (stl_algobase.h:366)
==20546==    by 0xE63FAB9: LuaStateForThread* std::__copy_move_a<false, LuaStateForThread*, LuaStateForThread*>(LuaStateForThread*, LuaStateForThread*, LuaStateForThread*) (stl_algobase.h:384)
==20546==    by 0xE63E896: __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > std::__copy_move_a2<false, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > >(__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >) (stl_algobase.h:422)
==20546==    by 0xE63D72A: __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > std::copy<__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > >(__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >) (stl_algobase.h:454)
==20546==    by 0xE63C69F: std::vector<LuaStateForThread, std::allocator<LuaStateForThread> >::erase(__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >) (vector.tcc:139)
==20546==    by 0xE63AB5D: manageLuaState(char) (LuaCsound.cpp:168)
==20546==    by 0xE63ACD3: csoundModuleDestroy (LuaCsound.cpp:738)
==20546==    by 0x4FE4B0E: csoundDestroyModules (csmodule.c:637)
==20546==    by 0x4FE88E6: reset (csound.c:2616)
==20546==    by 0x4FE55A1: csoundDestroy (csound.c:1192)
==20546==    by 0x4FE524E: destroy_all_instances (csound.c:888)
==20546==  Address 0x6f59750 is 16 bytes after a block of size 16 free'd
==20546==    at 0x4C2B59C: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==20546==    by 0xE63F8F5: __gnu_cxx::new_allocator<LuaStateForThread>::deallocate(LuaStateForThread*, unsigned long) (new_allocator.h:100)
==20546==    by 0xE63E5CB: std::_Vector_base<LuaStateForThread, std::allocator<LuaStateForThread> >::_M_deallocate(LuaStateForThread*, unsigned long) (stl_vector.h:175)
==20546==    by 0xE63D0F8: std::_Vector_base<LuaStateForThread, std::allocator<LuaStateForThread> >::~_Vector_base() (stl_vector.h:161)
==20546==    by 0xE63C44B: std::vector<LuaStateForThread, std::allocator<LuaStateForThread> >::~vector() (stl_vector.h:404)
==20546==    by 0x57BC120: __run_exit_handlers (exit.c:77)
==20546==    by 0x57BC1A4: exit (exit.c:99)
==20546==    by 0x57A1EAB: (below main) (libc-start.c:294)
==20546==
Csound tidy up: Segmentation fault
==20546==
==20546== HEAP SUMMARY:
==20546==     in use at exit: 828,250 bytes in 7,975 blocks
==20546==   total heap usage: 17,113 allocs, 9,138 frees, 1,827,395 bytes allocated
==20546==
==20546== LEAK SUMMARY:
==20546==    definitely lost: 616 bytes in 1 blocks
==20546==    indirectly lost: 26,097 bytes in 386 blocks
==20546==      possibly lost: 625,242 bytes in 7,261 blocks
==20546==    still reachable: 176,295 bytes in 327 blocks
==20546==         suppressed: 0 bytes in 0 blocks
==20546== Rerun with --leak-check=full to see details of leaked memory
==20546==
==20546== For counts of detected and suppressed errors, rerun with: -v
==20546== ERROR SUMMARY: 681931 errors from 6 contexts (suppressed: 2 from 2)

Cheers,
Andrés


Date2013-07-02 23:29
FromVictor Lazzarini
SubjectRe: [Cs-dev] lua cleanup
AttachmentsNone  None  
Last time I tried, the Lua opcodes were crashing Csound on OSX 64bit, so I have not been building them.
On 2 Jul 2013, at 22:46, Andres Cabrera wrote:

Hi,

Is it just me having this issue?

Cheers,
Andrés


On Mon, Jul 1, 2013 at 4:28 PM, Andres Cabrera <mantaraya36@gmail.com> wrote:

Hi,

I'm having trouble with the cleanup of the Lua module when the application exits and calls the atexit registered function. If I remove the Lua module, there is no problem.

Strangely, testChannels will run fine, but testCsoundTypeSystem will fail:

0    __memmove_ssse3_back        1548    0x7ffff721ba2f   
1    std::__copy_move<false, true, std::random_access_iterator_tag>::__copy_m<LuaStateForThread>    stl_algobase.h    366    0x7fffee7dc3a6   
2    std::__copy_move_a<false, LuaStateForThread*, LuaStateForThread*>    stl_algobase.h    384    0x7fffee7dbaba   
3    std::__copy_move_a2<false, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > >    stl_algobase.h    422    0x7fffee7da897   
4    std::copy<__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > >    stl_algobase.h    454    0x7fffee7d972b   
5    std::vector<LuaStateForThread, std::allocator<LuaStateForThread> >::erase    vector.tcc    139    0x7fffee7d86a0   
6    manageLuaState    LuaCsound.cpp    168    0x7fffee7d6b5e   
7    csoundModuleDestroy    LuaCsound.cpp    738    0x7fffee7d6cd4   
8    csoundDestroyModules    csmodule.c    637    0x7ffff7a67b0f   
9    reset    csound.c    2616    0x7ffff7a6b8e7   
10    csoundDestroy    csound.c    1192    0x7ffff7a685a2   
11    destroy_all_instances    csound.c    888    0x7ffff7a6824f   
12    __run_exit_handlers        77    0x7ffff7102121   
13    __GI_exit        99    0x7ffff71021a5   
14    __libc_start_main        294    0x7ffff70e7eac   
15    _start            0x400cb9   


valgrind reports:

~/Documents/src/csound-csound6-git-build/tests/c $
andres@andres-ThinkPad-W530 ~/Documents/src/csound-csound6-git-build/tests/c $ valgrind ./testCsoundTypeSystem
==20546== Memcheck, a memory error detector
==20546== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==20546== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==20546== Command: ./testCsoundTypeSystem
==20546==


     CUnit - A Unit testing framework for C - Version 2.1-0
     http://cunit.sourceforge.net/


Suite: Type System Tests
  Test: Test Type System ... virtual_keyboard real time MIDI plugin for Csound
0dBFS level = 32768.0
Csound version 6.00 (double samples) Jul  1 2013
libsndfile-1.0.25
passed
  Test: Test getVarSimpleName ... virtual_keyboard real time MIDI plugin for Csound
0dBFS level = 32768.0
Csound version 6.00 (double samples) Jul  1 2013
libsndfile-1.0.25
passed

--Run Summary: Type      Total     Ran  Passed  Failed
               suites        1       1     n/a       0
               tests         2       2       2       0
               asserts       9       9       9       0
end of score.           overall amps:      0.0
       overall samples out of range:        0
0 errors in performance
Elapsed time at end of performance: real: 0.294s, CPU: 0.050s
==20546== Invalid read of size 8
==20546==    at 0xE63A94A: operator==(LuaStateForThread const&, LuaStateForThread const&) (LuaCsound.cpp:122)
==20546==    by 0xE63D345: __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > std::__find<__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, LuaStateForThread>(__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, LuaStateForThread const&, std::random_access_iterator_tag) (stl_algo.h:190)
==20546==    by 0xE63C4F9: __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > std::find<__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, LuaStateForThread>(__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, LuaStateForThread const&) (stl_algo.h:4466)
==20546==    by 0xE63AA1D: manageLuaState(char) (LuaCsound.cpp:143)
==20546==    by 0xE63ACD3: csoundModuleDestroy (LuaCsound.cpp:738)
==20546==    by 0x4FE4B0E: csoundDestroyModules (csmodule.c:637)
==20546==    by 0x4FE88E6: reset (csound.c:2616)
==20546==    by 0x4FE55A1: csoundDestroy (csound.c:1192)
==20546==    by 0x4FE524E: destroy_all_instances (csound.c:888)
==20546==    by 0x57BC120: __run_exit_handlers (exit.c:77)
==20546==    by 0x57BC1A4: exit (exit.c:99)
==20546==    by 0x57A1EAB: (below main) (libc-start.c:294)
==20546==  Address 0x6f59730 is 0 bytes inside a block of size 16 free'd
==20546==    at 0x4C2B59C: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==20546==    by 0xE63F8F5: __gnu_cxx::new_allocator<LuaStateForThread>::deallocate(LuaStateForThread*, unsigned long) (new_allocator.h:100)
==20546==    by 0xE63E5CB: std::_Vector_base<LuaStateForThread, std::allocator<LuaStateForThread> >::_M_deallocate(LuaStateForThread*, unsigned long) (stl_vector.h:175)
==20546==    by 0xE63D0F8: std::_Vector_base<LuaStateForThread, std::allocator<LuaStateForThread> >::~_Vector_base() (stl_vector.h:161)
==20546==    by 0xE63C44B: std::vector<LuaStateForThread, std::allocator<LuaStateForThread> >::~vector() (stl_vector.h:404)
==20546==    by 0x57BC120: __run_exit_handlers (exit.c:77)
==20546==    by 0x57BC1A4: exit (exit.c:99)
==20546==    by 0x57A1EAB: (below main) (libc-start.c:294)
==20546==
==20546== Invalid read of size 8
==20546==    at 0xE63AB07: manageLuaState(char) (LuaCsound.cpp:165)
==20546==    by 0xE63ACD3: csoundModuleDestroy (LuaCsound.cpp:738)
==20546==    by 0x4FE4B0E: csoundDestroyModules (csmodule.c:637)
==20546==    by 0x4FE88E6: reset (csound.c:2616)
==20546==    by 0x4FE55A1: csoundDestroy (csound.c:1192)
==20546==    by 0x4FE524E: destroy_all_instances (csound.c:888)
==20546==    by 0x57BC120: __run_exit_handlers (exit.c:77)
==20546==    by 0x57BC1A4: exit (exit.c:99)
==20546==    by 0x57A1EAB: (below main) (libc-start.c:294)
==20546==  Address 0x6f59738 is 8 bytes inside a block of size 16 free'd
==20546==    at 0x4C2B59C: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==20546==    by 0xE63F8F5: __gnu_cxx::new_allocator<LuaStateForThread>::deallocate(LuaStateForThread*, unsigned long) (new_allocator.h:100)
==20546==    by 0xE63E5CB: std::_Vector_base<LuaStateForThread, std::allocator<LuaStateForThread> >::_M_deallocate(LuaStateForThread*, unsigned long) (stl_vector.h:175)
==20546==    by 0xE63D0F8: std::_Vector_base<LuaStateForThread, std::allocator<LuaStateForThread> >::~_Vector_base() (stl_vector.h:161)
==20546==    by 0xE63C44B: std::vector<LuaStateForThread, std::allocator<LuaStateForThread> >::~vector() (stl_vector.h:404)
==20546==    by 0x57BC120: __run_exit_handlers (exit.c:77)
==20546==    by 0x57BC1A4: exit (exit.c:99)
==20546==    by 0x57A1EAB: (below main) (libc-start.c:294)
==20546==
==20546== Invalid read of size 8
==20546==    at 0xE63AB43: manageLuaState(char) (LuaCsound.cpp:166)
==20546==    by 0xE63ACD3: csoundModuleDestroy (LuaCsound.cpp:738)
==20546==    by 0x4FE4B0E: csoundDestroyModules (csmodule.c:637)
==20546==    by 0x4FE88E6: reset (csound.c:2616)
==20546==    by 0x4FE55A1: csoundDestroy (csound.c:1192)
==20546==    by 0x4FE524E: destroy_all_instances (csound.c:888)
==20546==    by 0x57BC120: __run_exit_handlers (exit.c:77)
==20546==    by 0x57BC1A4: exit (exit.c:99)
==20546==    by 0x57A1EAB: (below main) (libc-start.c:294)
==20546==  Address 0x6f59738 is 8 bytes inside a block of size 16 free'd
==20546==    at 0x4C2B59C: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==20546==    by 0xE63F8F5: __gnu_cxx::new_allocator<LuaStateForThread>::deallocate(LuaStateForThread*, unsigned long) (new_allocator.h:100)
==20546==    by 0xE63E5CB: std::_Vector_base<LuaStateForThread, std::allocator<LuaStateForThread> >::_M_deallocate(LuaStateForThread*, unsigned long) (stl_vector.h:175)
==20546==    by 0xE63D0F8: std::_Vector_base<LuaStateForThread, std::allocator<LuaStateForThread> >::~_Vector_base() (stl_vector.h:161)
==20546==    by 0xE63C44B: std::vector<LuaStateForThread, std::allocator<LuaStateForThread> >::~vector() (stl_vector.h:404)
==20546==    by 0x57BC120: __run_exit_handlers (exit.c:77)
==20546==    by 0x57BC1A4: exit (exit.c:99)
==20546==    by 0x57A1EAB: (below main) (libc-start.c:294)
==20546==
end of score.           overall amps:      0.0
       overall samples out of range:        0
0 errors in performance
Elapsed time at end of performance: real: 0.653s, CPU: 0.400s
==20546== Invalid read of size 8
==20546==    at 0x4C2E610: memcpy@GLIBC_2.2.5 (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==20546==    by 0xE6403A5: LuaStateForThread* std::__copy_move<false, true, std::random_access_iterator_tag>::__copy_m<LuaStateForThread>(LuaStateForThread const*, LuaStateForThread const*, LuaStateForThread*) (stl_algobase.h:366)
==20546==    by 0xE63FAB9: LuaStateForThread* std::__copy_move_a<false, LuaStateForThread*, LuaStateForThread*>(LuaStateForThread*, LuaStateForThread*, LuaStateForThread*) (stl_algobase.h:384)
==20546==    by 0xE63E896: __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > std::__copy_move_a2<false, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > >(__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >) (stl_algobase.h:422)
==20546==    by 0xE63D72A: __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > std::copy<__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > >(__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >) (stl_algobase.h:454)
==20546==    by 0xE63C69F: std::vector<LuaStateForThread, std::allocator<LuaStateForThread> >::erase(__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >) (vector.tcc:139)
==20546==    by 0xE63AB5D: manageLuaState(char) (LuaCsound.cpp:168)
==20546==    by 0xE63ACD3: csoundModuleDestroy (LuaCsound.cpp:738)
==20546==    by 0x4FE4B0E: csoundDestroyModules (csmodule.c:637)
==20546==    by 0x4FE88E6: reset (csound.c:2616)
==20546==    by 0x4FE55A1: csoundDestroy (csound.c:1192)
==20546==    by 0x4FE524E: destroy_all_instances (csound.c:888)
==20546==  Address 0x6f59740 is 0 bytes after a block of size 16 free'd
==20546==    at 0x4C2B59C: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==20546==    by 0xE63F8F5: __gnu_cxx::new_allocator<LuaStateForThread>::deallocate(LuaStateForThread*, unsigned long) (new_allocator.h:100)
==20546==    by 0xE63E5CB: std::_Vector_base<LuaStateForThread, std::allocator<LuaStateForThread> >::_M_deallocate(LuaStateForThread*, unsigned long) (stl_vector.h:175)
==20546==    by 0xE63D0F8: std::_Vector_base<LuaStateForThread, std::allocator<LuaStateForThread> >::~_Vector_base() (stl_vector.h:161)
==20546==    by 0xE63C44B: std::vector<LuaStateForThread, std::allocator<LuaStateForThread> >::~vector() (stl_vector.h:404)
==20546==    by 0x57BC120: __run_exit_handlers (exit.c:77)
==20546==    by 0x57BC1A4: exit (exit.c:99)
==20546==    by 0x57A1EAB: (below main) (libc-start.c:294)
==20546==
==20546== Invalid write of size 8
==20546==    at 0x4C2E613: memcpy@GLIBC_2.2.5 (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==20546==    by 0xE6403A5: LuaStateForThread* std::__copy_move<false, true, std::random_access_iterator_tag>::__copy_m<LuaStateForThread>(LuaStateForThread const*, LuaStateForThread const*, LuaStateForThread*) (stl_algobase.h:366)
==20546==    by 0xE63FAB9: LuaStateForThread* std::__copy_move_a<false, LuaStateForThread*, LuaStateForThread*>(LuaStateForThread*, LuaStateForThread*, LuaStateForThread*) (stl_algobase.h:384)
==20546==    by 0xE63E896: __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > std::__copy_move_a2<false, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > >(__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >) (stl_algobase.h:422)
==20546==    by 0xE63D72A: __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > std::copy<__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > >(__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >) (stl_algobase.h:454)
==20546==    by 0xE63C69F: std::vector<LuaStateForThread, std::allocator<LuaStateForThread> >::erase(__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >) (vector.tcc:139)
==20546==    by 0xE63AB5D: manageLuaState(char) (LuaCsound.cpp:168)
==20546==    by 0xE63ACD3: csoundModuleDestroy (LuaCsound.cpp:738)
==20546==    by 0x4FE4B0E: csoundDestroyModules (csmodule.c:637)
==20546==    by 0x4FE88E6: reset (csound.c:2616)
==20546==    by 0x4FE55A1: csoundDestroy (csound.c:1192)
==20546==    by 0x4FE524E: destroy_all_instances (csound.c:888)
==20546==  Address 0x6f59730 is 0 bytes inside a block of size 16 free'd
==20546==    at 0x4C2B59C: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==20546==    by 0xE63F8F5: __gnu_cxx::new_allocator<LuaStateForThread>::deallocate(LuaStateForThread*, unsigned long) (new_allocator.h:100)
==20546==    by 0xE63E5CB: std::_Vector_base<LuaStateForThread, std::allocator<LuaStateForThread> >::_M_deallocate(LuaStateForThread*, unsigned long) (stl_vector.h:175)
==20546==    by 0xE63D0F8: std::_Vector_base<LuaStateForThread, std::allocator<LuaStateForThread> >::~_Vector_base() (stl_vector.h:161)
==20546==    by 0xE63C44B: std::vector<LuaStateForThread, std::allocator<LuaStateForThread> >::~vector() (stl_vector.h:404)
==20546==    by 0x57BC120: __run_exit_handlers (exit.c:77)
==20546==    by 0x57BC1A4: exit (exit.c:99)
==20546==    by 0x57A1EAB: (below main) (libc-start.c:294)
==20546==
==20546== Invalid read of size 8
==20546==    at 0x4C2E61E: memcpy@GLIBC_2.2.5 (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==20546==    by 0xE6403A5: LuaStateForThread* std::__copy_move<false, true, std::random_access_iterator_tag>::__copy_m<LuaStateForThread>(LuaStateForThread const*, LuaStateForThread const*, LuaStateForThread*) (stl_algobase.h:366)
==20546==    by 0xE63FAB9: LuaStateForThread* std::__copy_move_a<false, LuaStateForThread*, LuaStateForThread*>(LuaStateForThread*, LuaStateForThread*, LuaStateForThread*) (stl_algobase.h:384)
==20546==    by 0xE63E896: __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > std::__copy_move_a2<false, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > >(__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >) (stl_algobase.h:422)
==20546==    by 0xE63D72A: __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > std::copy<__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > > >(__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >, __gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >) (stl_algobase.h:454)
==20546==    by 0xE63C69F: std::vector<LuaStateForThread, std::allocator<LuaStateForThread> >::erase(__gnu_cxx::__normal_iterator<LuaStateForThread*, std::vector<LuaStateForThread, std::allocator<LuaStateForThread> > >) (vector.tcc:139)
==20546==    by 0xE63AB5D: manageLuaState(char) (LuaCsound.cpp:168)
==20546==    by 0xE63ACD3: csoundModuleDestroy (LuaCsound.cpp:738)
==20546==    by 0x4FE4B0E: csoundDestroyModules (csmodule.c:637)
==20546==    by 0x4FE88E6: reset (csound.c:2616)
==20546==    by 0x4FE55A1: csoundDestroy (csound.c:1192)
==20546==    by 0x4FE524E: destroy_all_instances (csound.c:888)
==20546==  Address 0x6f59750 is 16 bytes after a block of size 16 free'd
==20546==    at 0x4C2B59C: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==20546==    by 0xE63F8F5: __gnu_cxx::new_allocator<LuaStateForThread>::deallocate(LuaStateForThread*, unsigned long) (new_allocator.h:100)
==20546==    by 0xE63E5CB: std::_Vector_base<LuaStateForThread, std::allocator<LuaStateForThread> >::_M_deallocate(LuaStateForThread*, unsigned long) (stl_vector.h:175)
==20546==    by 0xE63D0F8: std::_Vector_base<LuaStateForThread, std::allocator<LuaStateForThread> >::~_Vector_base() (stl_vector.h:161)
==20546==    by 0xE63C44B: std::vector<LuaStateForThread, std::allocator<LuaStateForThread> >::~vector() (stl_vector.h:404)
==20546==    by 0x57BC120: __run_exit_handlers (exit.c:77)
==20546==    by 0x57BC1A4: exit (exit.c:99)
==20546==    by 0x57A1EAB: (below main) (libc-start.c:294)
==20546==
Csound tidy up: Segmentation fault
==20546==
==20546== HEAP SUMMARY:
==20546==     in use at exit: 828,250 bytes in 7,975 blocks
==20546==   total heap usage: 17,113 allocs, 9,138 frees, 1,827,395 bytes allocated
==20546==
==20546== LEAK SUMMARY:
==20546==    definitely lost: 616 bytes in 1 blocks
==20546==    indirectly lost: 26,097 bytes in 386 blocks
==20546==      possibly lost: 625,242 bytes in 7,261 blocks
==20546==    still reachable: 176,295 bytes in 327 blocks
==20546==         suppressed: 0 bytes in 0 blocks
==20546== Rerun with --leak-check=full to see details of leaked memory
==20546==
==20546== For counts of detected and suppressed errors, rerun with: -v
==20546== ERROR SUMMARY: 681931 errors from 6 contexts (suppressed: 2 from 2)

Cheers,
Andrés

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie