All of lore.kernel.org
 help / color / mirror / Atom feed
* Memory leak in via_isa_realize()
@ 2022-03-21 10:31 Thomas Huth
  2022-03-21 11:12 ` Peter Maydell
  2022-03-21 13:04 ` Philippe Mathieu-Daudé
  0 siblings, 2 replies; 16+ messages in thread
From: Thomas Huth @ 2022-03-21 10:31 UTC (permalink / raw)
  To: QEMU Developers, Huacai Chen, Philippe Mathieu-Daudé; +Cc: Peter Maydell


  Hi!

FYI, I'm seeing a memory leak in via_isa_realize() when building
QEMU with sanitizers enabled or when running QEMU through valgrind:

$ valgrind --leak-check=full --show-leak-kinds=definite ./qemu-system-mips64el --nographic -M fuloong2e
==210405== Memcheck, a memory error detector
==210405== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==210405== Using Valgrind-3.17.0 and LibVEX; rerun with -h for copyright info
==210405== Command: ./qemu-system-mips64el --nographic -M fuloong2e
==210405==
==210405== Warning: set address range perms: large range [0x15c9f000, 0x55c9f000) (defined)
==210405== Warning: set address range perms: large range [0x59ea4000, 0x99ea4000) (defined)
==210405== Warning: set address range perms: large range [0x99ea4000, 0xaa0a4000) (noaccess)
QEMU 6.2.90 monitor - type 'help' for more information
(qemu) q
==210405==
==210405== HEAP SUMMARY:
==210405==     in use at exit: 8,409,442 bytes in 23,516 blocks
==210405==   total heap usage: 37,073 allocs, 13,557 frees, 32,674,469 bytes allocated
==210405==
==210405== 8 bytes in 1 blocks are definitely lost in loss record 715 of 6,085
==210405==    at 0x4C360A5: malloc (vg_replace_malloc.c:380)
==210405==    by 0x7059475: g_malloc (in /usr/lib64/libglib-2.0.so.0.5600.4)
==210405==    by 0x96C52C: qemu_extend_irqs (irq.c:57)
==210405==    by 0x96C5B8: qemu_allocate_irqs (irq.c:66)
==210405==    by 0x5FFA47: via_isa_realize (vt82c686.c:591)
==210405==    by 0x5FFCDA: vt82c686b_realize (vt82c686.c:646)
==210405==    by 0x681502: pci_qdev_realize (pci.c:2192)
==210405==    by 0x969A5D: device_set_realized (qdev.c:531)
==210405==    by 0x97354A: property_set_bool (object.c:2273)
==210405==    by 0x9715A0: object_property_set (object.c:1408)
==210405==    by 0x975938: object_property_set_qobject (qom-qobject.c:28)
==210405==    by 0x971907: object_property_set_bool (object.c:1477)
==210405==
==210405== LEAK SUMMARY:
==210405==    definitely lost: 8 bytes in 1 blocks
==210405==    indirectly lost: 0 bytes in 0 blocks
==210405==      possibly lost: 3,794 bytes in 45 blocks
==210405==    still reachable: 8,405,640 bytes in 23,470 blocks
==210405==                       of which reachable via heuristic:
==210405==                         newarray           : 1,536 bytes in 16 blocks
==210405==         suppressed: 0 bytes in 0 blocks
==210405== Reachable blocks (those to which a pointer was found) are not shown.
==210405== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==210405==
==210405== For lists of detected and suppressed errors, rerun with: -s
==210405== ERROR SUMMARY: 46 errors from 46 contexts (suppressed: 0 from 0)

Same problem happens with qemu-system-ppc64 and the pegasos2 machine.

No clue how to properly fix this... is it safe to free the pointer
at the end of the function?

  Thomas



^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2022-03-23 22:54 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-21 10:31 Memory leak in via_isa_realize() Thomas Huth
2022-03-21 11:12 ` Peter Maydell
2022-03-21 12:11   ` BALATON Zoltan
2022-03-21 12:59     ` Peter Maydell
2022-03-22  7:55       ` Thomas Huth
2022-03-21 18:57     ` Cédric Le Goater
2022-03-21 21:16       ` BALATON Zoltan
2022-03-21 18:34   ` BALATON Zoltan
2022-03-21 13:04 ` Philippe Mathieu-Daudé
2022-03-21 18:55   ` Cédric Le Goater
2022-03-21 19:03     ` Philippe Mathieu-Daudé
2022-03-21 20:35     ` Peter Maydell
2022-03-22  8:23       ` Mark Cave-Ayland
2022-03-22  8:37         ` Thomas Huth
2022-03-22  8:41           ` Cédric Le Goater
2022-03-23 22:53         ` Bernhard Beschow

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.