- Код: Выделить всё
- program simpl_test;
 {$MODE OBJFPC}
 type
 TSomeObj = class
 public
 constructor create();
 destructor destroy;
 end;
 constructor TSomeObj.create();
 begin
 end;
 destructor TSomeObj.destroy;
 begin
 end;
 var
 obj : TSomeObj;
 begin
 obj := TSomeObj.create();
 obj.destroy
 end.
компилировал: fpc -g -gv -dDEBUG -dGDB valgr.pp
-gv: означает поддержку valgrind
запустил: valgrind --trace-children=yes --leak-check=full ./valgr
- Код: Выделить всё
- ==27268== Memcheck, a memory error detector.
 ==27268== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
 ==27268== Using LibVEX rev 1732, a library for dynamic binary translation.
 ==27268== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
 ==27268== Using valgrind-3.2.3, a dynamic binary instrumentation framework.
 ==27268== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
 ==27268== For more details, rerun with: -v
 ==27268==
 ==27268== Invalid free() / delete / delete[]
 ==27268== at 0x402254C: free (in /usr/lib/valgrind/x86-linux/vgpreload_memcheck.so)
 ==27268== by 0x4141CCE: __libc_freeres (in /lib/libc-2.6.1.so)
 ==27268== by 0x401C256: _vgnU_freeres (in /usr/lib/valgrind/x86-linux/vgpreload_core.so)
 ==27268== by 0x805E963: SYSTEM_SYSTEM_EXIT (in /home/wow/devel/pascal/system/valgr)
 ==27268== by 0x80576D9: SYSTEM_DO_EXIT (in /home/wow/devel/pascal/system/valgr)
 ==27268== by 0x805F890: SI_PRC__FPC_PROC_START (in /home/wow/devel/pascal/system/valgr)
 ==27268== Address 0xFFFFFFFF is not stack'd, malloc'd or (recently) free'd
 ==27268==
 ==27268== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 7 from 1)
 ==27268== malloc/free: in use at exit: 0 bytes in 0 blocks.
 ==27268== malloc/free: 1 allocs, 2 frees, 8 bytes allocated.
 ==27268== For counts of detected errors, rerun with: -v
 ==27268== All heap blocks were freed -- no leaks are possible.
Пишет - Invalid free() / delete / delete[]
Чтобы это значило?
Хотя утечки памяти определяет верно.





