swipl-devel
swipl-devel copied to clipboard
Memory leak from GMP
test_cpp.{cpp,pl} causes a memory leak in GMP (this seems to be related to bug https://github.com/SWI-Prolog/swipl-devel/issues/1141). The cause seems to be that mpz_init_set_si64(MPZ_MIN_TAGGED, PLMINTAGGEDINT) causes a GMP object to be allocated, but the swipl functions allocation functions are set up after this call.
PR https://github.com/SWI-Prolog/swipl-devel/pull/1147 contains a proposed fix, but it doesn't seem to fix things. When all my PRs have been merged, I'll try to figure this out - there seem to have been a number of possibly conflicting changes made to the GMP code (or possibly git diff is confused).
Normally, this wouldn't be an issue; but it means that some of the GMP memory could be freed using a different memory manager than when it was created.