Юрий, добрый день!
Это не утечка памяти. В библиотеке
имеется график по умолчанию (см. функцию mgl_default_graph() ),
которые и используется при использовании конструктора mglGraph с
параметром kind отличным от 0 и 1 -- это и немного быстрее, и
сохраняет настройки между вызовами mglGraph в разных частях кода.
Естественно, что удаление объекта mglGraph лишь уменьшает счетчик
использования на 1, и если значение счетчика меньше 1, то удаляет
объект HMGL.
По какой причине у Вас остается доступ
к переменной HMGL gr; объекта mglGraph мне не совсем понятно --
видимо сборщик мусора не считает нужным удалять место ей
занимаемое сразу???
С уважением, Алексей Балакин
------------------------------------------
English translation now:
This is not a memory leak. The library
has a default HMGL graph (see the function mgl_default_graph()),
which is used when calling the mglGraph constructor with the kind
parameter other than 0 or 1. This make startup a little faster and
saves settings between calls to mglGraph in different parts of a
code. Of course, deleting the mglGraph object only decrements the
usage counter by 1, and if the counter is less than 1 then it
deletes the HMGL object.
Why do you still have access to the variable HMGL gr; of the
object mglGraph is not entirely clear to me -- probably the
garbage collector does not consider it necessary to delete the
place it occupies immediately???
Sincerely, Alexey Balakin
24.10.2022 21:13, Юрий Бобылев пишет:
Здравствуйте, Алексей!
В версии библиотеки 8.0.1 по-видимому есть утечка памяти. При
создании объекта mglGraph через оператор new (C++), после
освобождения памяти оператором delete остаётся возможность
обратиться к функциям библиотеки через тот же указатель.
С уважением, Юрий Бобылев.
--
You received this message because you are subscribed to the Google
Groups "MathGL" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to mathgl+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mathgl/3f249ab9-a164-46ce-895b-6f71c3115318n%40googlegroups.com.