I believe I found a few mem-leaks, one on an error path that you're unlikely to hit. Another more generic/possible mem-leak, which is likely the one you're hitting.
I can definitely patch upstream and FreeIPMI 1.5.X, but FreeIPMI 1.2.9 is well past support. Can you use 1.5.X? Al On Mon, Jul 17, 2017 at 2:40 PM, Albert Chu <ch...@llnl.gov> wrote: > Hi, > > Skimming through code, it seems I may not be freeing memory after the > call to ipmi_get_event_messages(). I'll have to look at this a bit more > carefully, but I think you're right. > > Al > > On Mon, 2017-07-17 at 09:00 +0000, Yun Sangwon wrote: > > Hello, > > > > I'm using the ipmimonitoring library of freeipmi 1.2.9-8.el7.x86_64 on > RHEL 7.3 to monitor values of sensors using IPMI in a program. > > For continued monitoring, the program calls the API > ipmi_monitoring_sensor_readings_by_record_id() every period (in my case > 10 seconds). > > > > It works fine but for me there is a memory leak issue. > > > > Through some tests, I think the issue is being happened on the API > ipmi_monitoring_sensor_readings_by_record_id(). > > For the information, valgrind report is same as below: > > > > $ valgrind --trace-children=yes --leak-check=full > --log-file=/tmp/valgrind-ipmimon.txt ./ipmimonitoring-sensors > > > > $ cat /tmp/valgrind-ipmimon.txt > > ==10568== Memcheck, a memory error detector > > ==10568== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al. > > ==10568== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright > info > > ==10568== Command: ./ipmimonitoring-sensors > > ==10568== Parent PID: 25490 > > ==10568== > > ==10568== > > ==10568== Process terminating with default action of signal 2 (SIGINT) > > ==10568== at 0x592F650: __nanosleep_nocancel (in /usr/lib64/ > libc-2.17.so) > > ==10568== by 0x592F503: sleep (in /usr/lib64/libc-2.17.so) > > ==10568== by 0x401F9F: main (in /home/test/ipmimonitoring-sensors) > > ==10568== > > ==10568== HEAP SUMMARY: > > ==10568== in use at exit: 3,060 bytes in 180 blocks > > ==10568== total heap usage: 125,321 allocs, 125,141 frees, 264,313,716 > bytes allocated > > ==10568== > > ==10568== 3,060 (1,440 direct, 1,620 indirect) bytes in 90 blocks are > definitely lost in loss record 2 of 2 > > ==10568== at 0x4C28BE3: malloc (vg_replace_malloc.c:299) > > ==10568== by 0x5DC25F1: ipmi_get_event_messages (in > /usr/lib64/libfreeipmi.so.13.1.7) > > ==10568== by 0x4E3F704: ??? (in /usr/lib64/libipmimonitoring. > so.5.0.5) > > ==10568== by 0x4E41626: ??? (in /usr/lib64/libipmimonitoring. > so.5.0.5) > > ==10568== by 0x4E3904F: ??? (in /usr/lib64/libipmimonitoring. > so.5.0.5) > > ==10568== by 0x5DA44B9: ipmi_sdr_cache_iterate (in > /usr/lib64/libfreeipmi.so.13.1.7) > > ==10568== by 0x4E3A853: ??? (in /usr/lib64/libipmimonitoring. > so.5.0.5) > > ==10568== by 0x4E3AA3B: ipmi_monitoring_sensor_readings_by_record_id > (in /usr/lib64/libipmimonitoring.so.5.0.5) > > ==10568== by 0x40169F: _ipmimonitoring (in /home/test/ipmimonitoring- > sensors) > > ==10568== by 0x401F82: main (in /home/test/ipmimonitoring-sensors) > > ==10568== > > ==10568== LEAK SUMMARY: > > ==10568== definitely lost: 1,440 bytes in 90 blocks > > ==10568== indirectly lost: 1,620 bytes in 90 blocks > > ==10568== possibly lost: 0 bytes in 0 blocks > > ==10568== still reachable: 0 bytes in 0 blocks > > ==10568== suppressed: 0 bytes in 0 blocks > > ==10568== > > ==10568== For counts of detected and suppressed errors, rerun with: -v > > ==10568== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0) > > > > For the information, it is same in case of using the example > http://www.gnu.org/software/freeipmi/ipmimonitoring-sensors.c. > > > > I don't know whether it is my fault or freeipmi issue. > > For the moment I didn't test using latest version as I want to use the > freeipmi version 1.2.9-8 which is bundled on RHEL v7.3. > > > > Could you please guide or share any information? > > > > Thank you very much in advance. > > Sangwon > > _______________________________________________ > > Freeipmi-users mailing list > > Freeipmi-users@gnu.org > > https://lists.gnu.org/mailman/listinfo/freeipmi-users > > -- > Albert Chu > ch...@llnl.gov > Computer Scientist > High Performance Systems Division > Lawrence Livermore National Laboratory > > > > _______________________________________________ > Freeipmi-users mailing list > Freeipmi-users@gnu.org > https://lists.gnu.org/mailman/listinfo/freeipmi-users > _______________________________________________ Freeipmi-users mailing list Freeipmi-users@gnu.org https://lists.gnu.org/mailman/listinfo/freeipmi-users