HiGHS icon indicating copy to clipboard operation
HiGHS copied to clipboard

MEMCHECK: ==51803== 8,393,728 bytes in 16 blocks are possibly lost in loss record

Open JohnSmithBH84 opened this issue 6 months ago • 1 comments

I’ve scanned HiGHS with MEMCHECK and it has triggered on HiGHS/src/parallel/HighsCacheAlign.h line 30. I'm not sure whether this is an actual issue, or whether code of HiGHS is too sophisticated for MEMCHECK to understand. Do you guys have any idea?

Project version

HiGHS: master

Operating system

compiler: gcc (Debian 12.2.0-14) 12.2.0

Ubuntu 22.04.4 LTS Linux 5.15.0-125-generic #135-Ubuntu SMP Fri Sep 27 13:53:58 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

I did this

Launched /home/HiGHS/build/bin/call_highs_from_c_minimal

I expected the following

No problem reported by MEMCHECK

I got the following

/home/HiGHS/build/bin/call_highs_from_c_minimal
==51803== Memcheck, a memory error detector
==51803== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==51803== Using Valgrind-3.19.0 and LibVEX; rerun with -h for copyright info
==51803== Command: /home/HiGHS/build/bin/call_highs_from_c_minimal
==51803==
==51803==
==51803== HEAP SUMMARY:
==51803==     in use at exit: 8,398,792 bytes in 40 blocks
==51803==   total heap usage: 25,638 allocs, 25,598 frees, 12,002,855 bytes allocated
...
==51803== 8,393,728 bytes in 16 blocks are possibly lost in loss record 10 of 10
==51803==    at 0x4840F2F: operator new(unsigned long) (coregrind/m_replacemalloc/vg_replace_malloc.c:422)
==51803==    by 0x494A51F: highs::cache_aligned::alloc(unsigned long) (home/HiGHS/src/parallel/HighsCacheAlign.h:30)
==51803==    by 0x496500E: std::unique_ptr<HighsSplitDeque, highs::cache_aligned::Deleter<HighsSplitDeque> > highs::cache_aligned::make_unique<HighsSplitDeque, std::shared_ptr<HighsSplitDeque::WorkerBunk>&,
    std::unique_ptr<HighsSplitDeque, highs::cache_aligned::Deleter<HighsSplitDeque> >*, int&, int&>(std::shared_ptr<HighsSplitDeque::WorkerBunk>&, std::unique_ptr<HighsSplitDeque, highs::cache_aligned::Deleter<HighsSplitDeque> >*&&,
    int&, int&) (home/HiGHS/src/parallel/HighsCacheAlign.h:76)
==51803==    by 0x48B8EF2: HighsTaskExecutor::HighsTaskExecutor(int) (home/HiGHS/src/parallel/HighsTaskExecutor.h:122)
==51803==    by 0x494CB9F: HighsTaskExecutor::initialize(int) (home/HiGHS/src/parallel/HighsTaskExecutor.h:170)
==51803==    by 0x494CC42: highs::parallel::initialize_scheduler(int) (home/HiGHS/src/parallel/HighsParallel.h:33)
==51803==    by 0x49520A0: Highs::solve() (home/HiGHS/src/lp_data/Highs.cpp:952)
==51803==    by 0x4951D8A: Highs::run() (home/HiGHS/src/lp_data/Highs.cpp:909)
==51803==    by 0x48EE0BE: Highs_lpCall (home/HiGHS/src/interfaces/highs_c_api.cpp:30)
==51803==    by 0x10A617: minimal_api (home/HiGHS/examples/call_highs_from_c_minimal.c:101)
==51803==    by 0x10C99C: main (home/HiGHS/examples/call_highs_from_c_minimal.c:655)
==51803==
==51803== LEAK SUMMARY:
==51803==    definitely lost: 0 bytes in 0 blocks
==51803==    indirectly lost: 0 bytes in 0 blocks
==51803==      possibly lost: 8,398,728 bytes in 38 blocks
==51803==    still reachable: 64 bytes in 2 blocks
==51803==         suppressed: 0 bytes in 0 blocks
==51803== Reachable blocks (those to which a pointer was found) are not shown.
==51803== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==51803==
==51803== For lists of detected and suppressed errors, rerun with: -s
==51803== ERROR SUMMARY: 8 errors from 8 contexts (suppressed: 0 from 0)

JohnSmithBH84 avatar Jun 10 '25 07:06 JohnSmithBH84

I’ve scanned HiGHS with MEMCHECK and it has triggered on HiGHS/src/parallel/HighsCacheAlign.h line 30. I'm not sure whether this is an actual issue, or whether code of HiGHS is too sophisticated for MEMCHECK to understand. Do you guys have any idea?

I don't think that it's an issue, but the best person to respond is @galabovaa, but she's away this week.

jajhall avatar Jun 10 '25 10:06 jajhall

Hello @JohnSmithBH84, thank you for getting in touch!

This is not an actual issue, but there is still a way to clear the errors. I have done it elsewhere in the code, but forgot to add the examples, thank you for letting us know. I will work on a fix.

galabovaa avatar Jun 24 '25 16:06 galabovaa

Closed by https://github.com/ERGO-Code/HiGHS/pull/2493.

galabovaa avatar Aug 13 '25 13:08 galabovaa