.
En respuesta a Sofia Tito Virgilio Rodriguez
Re: 4. Detección de errores de memoria.
de Hugo Galbarini -
buenas!
implemente la funcion liberarFecha poniendo estas lineas de codigo como dice en la letra:
delete fecha;
fecha = NULL;
pero cuando hago la prueba con estos comandos, me aparece "==43630== in use at exit: 16,343 bytes in 165 blocks" en vez de "==378400== in use at exit: 0 bytes in 0 blocks" como dice en la letra:
1>crearFecha 21/5/2024
2>liberarFecha
3>Fin
cual podria ser la razon?
Terminal:
(base) hgalbarini@192 tarea1 % valgrind ./principal
==43630== Memcheck, a memory error detector
==43630== Copyright (C) 2002-2024, and GNU GPL'd, by Julian Seward et al.
==43630== Using Valgrind-3.25.0.GIT-lbmacos and LibVEX; rerun with -h for copyright info
==43630== Command: ./principal
==43630==
==43630== Conditional jump or move depends on uninitialised value(s)
==43630== at 0x7FF811C69A3F: ??? (in /dev/macos/internals/[shared pmap])
==43630== by 0x7FF811B263FD: __sfvwrite (in /usr/lib/system/libsystem_c.dylib)
==43630== by 0x7FF811B2490D: __vfprintf (in /usr/lib/system/libsystem_c.dylib)
==43630== by 0x7FF811B34C45: vfprintf_l (in /usr/lib/system/libsystem_c.dylib)
==43630== by 0x7FF811B54058: printf (in /usr/lib/system/libsystem_c.dylib)
==43630== by 0x100001F84: ??? (in ./principal)
==43630== by 0x10001552D: (below main) (in /usr/lib/dyld)
==43630==
1>crearFecha 21/5/2024
2>liberarFecha
3>Fin
Chau mundo.
==43630==
==43630== HEAP SUMMARY:
==43630== in use at exit: 16,343 bytes in 165 blocks
==43630== total heap usage: 170 allocs, 5 frees, 16,439 bytes allocated
==43630==
==43630== LEAK SUMMARY:
==43630== definitely lost: 4,160 bytes in 130 blocks
==43630== indirectly lost: 0 bytes in 0 blocks
==43630== possibly lost: 600 bytes in 3 blocks
==43630== still reachable: 11,583 bytes in 32 blocks
==43630== suppressed: 0 bytes in 0 blocks
==43630== Rerun with --leak-check=full to see details of leaked memory
==43630==
==43630== Use --track-origins=yes to see where uninitialised values come from
==43630== For lists of detected and suppressed errors, rerun with: -s
==43630== ERROR SUMMARY: 3 errors from 1 contexts (suppressed: 107 from 21)
implemente la funcion liberarFecha poniendo estas lineas de codigo como dice en la letra:
delete fecha;
fecha = NULL;
pero cuando hago la prueba con estos comandos, me aparece "==43630== in use at exit: 16,343 bytes in 165 blocks" en vez de "==378400== in use at exit: 0 bytes in 0 blocks" como dice en la letra:
1>crearFecha 21/5/2024
2>liberarFecha
3>Fin
cual podria ser la razon?
Terminal:
(base) hgalbarini@192 tarea1 % valgrind ./principal
==43630== Memcheck, a memory error detector
==43630== Copyright (C) 2002-2024, and GNU GPL'd, by Julian Seward et al.
==43630== Using Valgrind-3.25.0.GIT-lbmacos and LibVEX; rerun with -h for copyright info
==43630== Command: ./principal
==43630==
==43630== Conditional jump or move depends on uninitialised value(s)
==43630== at 0x7FF811C69A3F: ??? (in /dev/macos/internals/[shared pmap])
==43630== by 0x7FF811B263FD: __sfvwrite (in /usr/lib/system/libsystem_c.dylib)
==43630== by 0x7FF811B2490D: __vfprintf (in /usr/lib/system/libsystem_c.dylib)
==43630== by 0x7FF811B34C45: vfprintf_l (in /usr/lib/system/libsystem_c.dylib)
==43630== by 0x7FF811B54058: printf (in /usr/lib/system/libsystem_c.dylib)
==43630== by 0x100001F84: ??? (in ./principal)
==43630== by 0x10001552D: (below main) (in /usr/lib/dyld)
==43630==
1>crearFecha 21/5/2024
2>liberarFecha
3>Fin
Chau mundo.
==43630==
==43630== HEAP SUMMARY:
==43630== in use at exit: 16,343 bytes in 165 blocks
==43630== total heap usage: 170 allocs, 5 frees, 16,439 bytes allocated
==43630==
==43630== LEAK SUMMARY:
==43630== definitely lost: 4,160 bytes in 130 blocks
==43630== indirectly lost: 0 bytes in 0 blocks
==43630== possibly lost: 600 bytes in 3 blocks
==43630== still reachable: 11,583 bytes in 32 blocks
==43630== suppressed: 0 bytes in 0 blocks
==43630== Rerun with --leak-check=full to see details of leaked memory
==43630==
==43630== Use --track-origins=yes to see where uninitialised values come from
==43630== For lists of detected and suppressed errors, rerun with: -s
==43630== ERROR SUMMARY: 3 errors from 1 contexts (suppressed: 107 from 21)
Buenas,
Por lo pronto tenés un mensaje de "Chau mundo." en tu salida que no debería estar.
Fijate si se arregla por ahí.
Saludos,
Guillermo