2013-02-11 1 views
1

Мой учитель сказал, что у меня есть утечки памяти в моей программе, поэтому я использовал valgrind, чтобы проверить это. Я получил следующие ошибки:Утечки памяти проверены в valgrind

==24060== Invalid read of size 8 
==24060== at 0x4EB4B4C: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5E253: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5D328: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5CE85: setlocale (in /lib64/libc-2.16.so) 
==24060== by 0x401751: ??? (in /usr/bin/test) 
==24060== by 0x4E52804: (below main) (in /lib64/libc-2.16.so) 
==24060== Address 0x51dc040 is 0 bytes inside a block of size 5 alloc'd 
==24060== at 0x4C2AD7B: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) 
==24060== by 0x4E63D43: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5E23D: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5D328: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5CE85: setlocale (in /lib64/libc-2.16.so) 
==24060== by 0x401751: ??? (in /usr/bin/test) 
==24060== by 0x4E52804: (below main) (in /lib64/libc-2.16.so) 
==24060== 
==24060== Invalid read of size 8 
==24060== at 0x4EB4B54: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5E253: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5D328: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5CE85: setlocale (in /lib64/libc-2.16.so) 
==24060== by 0x401751: ??? (in /usr/bin/test) 
==24060== by 0x4E52804: (below main) (in /lib64/libc-2.16.so) 
==24060== Address 0x51dc048 is 3 bytes after a block of size 5 alloc'd 
==24060== at 0x4C2AD7B: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) 
==24060== by 0x4E63D43: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5E23D: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5D328: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5CE85: setlocale (in /lib64/libc-2.16.so) 
==24060== by 0x401751: ??? (in /usr/bin/test) 
==24060== by 0x4E52804: (below main) (in /lib64/libc-2.16.so) 
==24060== 
==24060== Invalid read of size 8 
==24060== at 0x4EB4931: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5E266: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5D328: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5CE85: setlocale (in /lib64/libc-2.16.so) 
==24060== by 0x401751: ??? (in /usr/bin/test) 
==24060== by 0x4E52804: (below main) (in /lib64/libc-2.16.so) 
==24060== Address 0x51dc040 is 0 bytes inside a block of size 5 alloc'd 
==24060== at 0x4C2AD7B: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) 
==24060== by 0x4E63D43: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5E23D: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5D328: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5CE85: setlocale (in /lib64/libc-2.16.so) 
==24060== by 0x401751: ??? (in /usr/bin/test) 
==24060== by 0x4E52804: (below main) (in /lib64/libc-2.16.so) 
==24060== 
==24060== Conditional jump or move depends on uninitialised value(s) 
==24060== at 0x4EB493F: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5DF87: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5D328: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5CE85: setlocale (in /lib64/libc-2.16.so) 
==24060== by 0x401751: ??? (in /usr/bin/test) 
==24060== by 0x4E52804: (below main) (in /lib64/libc-2.16.so) 
==24060== 
==24060== Conditional jump or move depends on uninitialised value(s) 
==24060== at 0x4E5DF8D: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5D328: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5CE85: setlocale (in /lib64/libc-2.16.so) 
==24060== by 0x401751: ??? (in /usr/bin/test) 
==24060== by 0x4E52804: (below main) (in /lib64/libc-2.16.so) 
==24060== 
==24060== Conditional jump or move depends on uninitialised value(s) 
==24060== at 0x4E5DFAF: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5D328: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5CE85: setlocale (in /lib64/libc-2.16.so) 
==24060== by 0x401751: ??? (in /usr/bin/test) 
==24060== by 0x4E52804: (below main) (in /lib64/libc-2.16.so) 
==24060== 
==24060== Use of uninitialised value of size 8 
==24060== at 0x4E5E033: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5D328: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5CE85: setlocale (in /lib64/libc-2.16.so) 
==24060== by 0x401751: ??? (in /usr/bin/test) 
==24060== by 0x4E52804: (below main) (in /lib64/libc-2.16.so) 
==24060== 
==24060== Use of uninitialised value of size 8 
==24060== at 0x4E5E041: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5D328: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5CE85: setlocale (in /lib64/libc-2.16.so) 
==24060== by 0x401751: ??? (in /usr/bin/test) 
==24060== by 0x4E52804: (below main) (in /lib64/libc-2.16.so) 
==24060== 
==24060== Conditional jump or move depends on uninitialised value(s) 
==24060== at 0x4E5E047: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5D328: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5CE85: setlocale (in /lib64/libc-2.16.so) 
==24060== by 0x401751: ??? (in /usr/bin/test) 
==24060== by 0x4E52804: (below main) (in /lib64/libc-2.16.so) 
==24060== 
==24060== Conditional jump or move depends on uninitialised value(s) 
==24060== at 0x4EB2E42: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5E06C: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5D328: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5CE85: setlocale (in /lib64/libc-2.16.so) 
==24060== by 0x401751: ??? (in /usr/bin/test) 
==24060== by 0x4E52804: (below main) (in /lib64/libc-2.16.so) 
==24060== 
==24060== Use of uninitialised value of size 8 
==24060== at 0x4EB4214: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5E06C: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5D328: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5CE85: setlocale (in /lib64/libc-2.16.so) 
==24060== by 0x401751: ??? (in /usr/bin/test) 
==24060== by 0x4E52804: (below main) (in /lib64/libc-2.16.so) 
==24060== 
==24060== Use of uninitialised value of size 8 
==24060== at 0x4EB4218: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5E06C: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5D328: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5CE85: setlocale (in /lib64/libc-2.16.so) 
==24060== by 0x401751: ??? (in /usr/bin/test) 
==24060== by 0x4E52804: (below main) (in /lib64/libc-2.16.so) 
==24060== 
==24060== Invalid read of size 8 
==24060== at 0x4EB2E1E: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5CECD: setlocale (in /lib64/libc-2.16.so) 
==24060== by 0x401751: ??? (in /usr/bin/test) 
==24060== by 0x4E52804: (below main) (in /lib64/libc-2.16.so) 
==24060== Address 0x51dc158 is 8 bytes inside a block of size 12 alloc'd 
==24060== at 0x4C2AD7B: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) 
==24060== by 0x4EB4591: strdup (in /lib64/libc-2.16.so) 
==24060== by 0x4E5E129: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5D328: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5CE85: setlocale (in /lib64/libc-2.16.so) 
==24060== by 0x401751: ??? (in /usr/bin/test) 
==24060== by 0x4E52804: (below main) (in /lib64/libc-2.16.so) 
==24060== 
==24060== Invalid read of size 8 
==24060== at 0x4EB4931: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4EB4585: strdup (in /lib64/libc-2.16.so) 
==24060== by 0x4E5CEE4: setlocale (in /lib64/libc-2.16.so) 
==24060== by 0x401751: ??? (in /usr/bin/test) 
==24060== by 0x4E52804: (below main) (in /lib64/libc-2.16.so) 
==24060== Address 0x51dc158 is 8 bytes inside a block of size 12 alloc'd 
==24060== at 0x4C2AD7B: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) 
==24060== by 0x4EB4591: strdup (in /lib64/libc-2.16.so) 
==24060== by 0x4E5E129: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5D328: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5CE85: setlocale (in /lib64/libc-2.16.so) 
==24060== by 0x401751: ??? (in /usr/bin/test) 
==24060== by 0x4E52804: (below main) (in /lib64/libc-2.16.so) 
==24060== 
==24060== Invalid read of size 8 
==24060== at 0x4EB2E23: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5DEFA: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5D328: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5CE85: setlocale (in /lib64/libc-2.16.so) 
==24060== by 0x401751: ??? (in /usr/bin/test) 
==24060== by 0x4E52804: (below main) (in /lib64/libc-2.16.so) 
==24060== Address 0x51dc158 is 8 bytes inside a block of size 12 alloc'd 
==24060== at 0x4C2AD7B: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) 
==24060== by 0x4EB4591: strdup (in /lib64/libc-2.16.so) 
==24060== by 0x4E5E129: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5D328: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5CE85: setlocale (in /lib64/libc-2.16.so) 
==24060== by 0x401751: ??? (in /usr/bin/test) 
==24060== by 0x4E52804: (below main) (in /lib64/libc-2.16.so) 
==24060== 
==24060== Invalid read of size 8 
==24060== at 0x4EB4931: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5C9D2: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5D0B2: setlocale (in /lib64/libc-2.16.so) 
==24060== by 0x401751: ??? (in /usr/bin/test) 
==24060== by 0x4E52804: (below main) (in /lib64/libc-2.16.so) 
==24060== Address 0x51dd568 is 8 bytes inside a block of size 12 alloc'd 
==24060== at 0x4C2AD7B: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) 
==24060== by 0x4EB4591: strdup (in /lib64/libc-2.16.so) 
==24060== by 0x4E5CEE4: setlocale (in /lib64/libc-2.16.so) 
==24060== by 0x401751: ??? (in /usr/bin/test) 
==24060== by 0x4E52804: (below main) (in /lib64/libc-2.16.so) 
==24060== 
==24060== Invalid read of size 8 
==24060== at 0x4EB2E1E: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5CA0F: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5D0B2: setlocale (in /lib64/libc-2.16.so) 
==24060== by 0x401751: ??? (in /usr/bin/test) 
==24060== by 0x4E52804: (below main) (in /lib64/libc-2.16.so) 
==24060== Address 0x51dd518 is 8 bytes inside a block of size 12 alloc'd 
==24060== at 0x4C2AD7B: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) 
==24060== by 0x4EB4591: strdup (in /lib64/libc-2.16.so) 
==24060== by 0x4E5CEE4: setlocale (in /lib64/libc-2.16.so) 
==24060== by 0x401751: ??? (in /usr/bin/test) 
==24060== by 0x4E52804: (below main) (in /lib64/libc-2.16.so) 
==24060== 
==24060== Invalid read of size 8 
==24060== at 0x4EB2E23: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5CA0F: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5D0B2: setlocale (in /lib64/libc-2.16.so) 
==24060== by 0x401751: ??? (in /usr/bin/test) 
==24060== by 0x4E52804: (below main) (in /lib64/libc-2.16.so) 
==24060== Address 0x51dd568 is 8 bytes inside a block of size 12 alloc'd 
==24060== at 0x4C2AD7B: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) 
==24060== by 0x4EB4591: strdup (in /lib64/libc-2.16.so) 
==24060== by 0x4E5CEE4: setlocale (in /lib64/libc-2.16.so) 
==24060== by 0x401751: ??? (in /usr/bin/test) 
==24060== by 0x4E52804: (below main) (in /lib64/libc-2.16.so) 
==24060== 
==24060== Invalid read of size 8 
==24060== at 0x4EB2E1E: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5CA83: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5D0B2: setlocale (in /lib64/libc-2.16.so) 
==24060== by 0x401751: ??? (in /usr/bin/test) 
==24060== by 0x4E52804: (below main) (in /lib64/libc-2.16.so) 
==24060== Address 0x51dd568 is 8 bytes inside a block of size 12 alloc'd 
==24060== at 0x4C2AD7B: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) 
==24060== by 0x4EB4591: strdup (in /lib64/libc-2.16.so) 
==24060== by 0x4E5CEE4: setlocale (in /lib64/libc-2.16.so) 
==24060== by 0x401751: ??? (in /usr/bin/test) 
==24060== by 0x4E52804: (below main) (in /lib64/libc-2.16.so) 
==24060== 
==24060== Invalid read of size 8 
==24060== at 0x4EB2E1E: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5CA9D: ??? (in /lib64/libc-2.16.so) 
==24060== by 0x4E5D0B2: setlocale (in /lib64/libc-2.16.so) 
==24060== by 0x401751: ??? (in /usr/bin/test) 
==24060== by 0x4E52804: (below main) (in /lib64/libc-2.16.so) 
==24060== Address 0x51dd568 is 8 bytes inside a block of size 12 alloc'd 
==24060== at 0x4C2AD7B: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) 
==24060== by 0x4EB4591: strdup (in /lib64/libc-2.16.so) 
==24060== by 0x4E5CEE4: setlocale (in /lib64/libc-2.16.so) 
==24060== by 0x401751: ??? (in /usr/bin/test) 
==24060== by 0x4E52804: (below main) (in /lib64/libc-2.16.so) 
==24060== 

Может кто-нибудь помочь мне понять, что означают эти ошибки?

+0

Я узнал, что на самом деле утечек памяти нет, однако я хотел бы избавиться от этих других ошибок. –

+0

Скомпилировать с '-g' – cnicutar

+0

Я скомпилировал с флагом -g, но это не помогло. Возможно, проблема в том, что у меня есть заголовочный файл в проекте? –

ответ

1

Почему вывод valgrind не показывает номера строк? Я не знаю, где искать эти ошибки. Я скомпилировал свою программу с флагом -g и использовал valgrind со следующим синтаксисом: valgrind --tool = memcheck --track-originins = yes -q test

+0

Вы создали новую учетную запись, чтобы ответить на свой вопрос? –

+0

Это была ошибка, извините. :) –