Показать сообщение отдельно
Старый 20.01.2023, 14:58   #2  
Logger is offline
Logger
Участник
Лучший по профессии 2015
Лучший по профессии 2014
 
3,875 / 3123 (112) ++++++++++
Регистрация: 12.10.2004
Адрес: Москва
Записей в блоге: 2
Интересно, что пока решал проблему, нагуглил вот такое описание

Цитата:
https://blogs.msdn.microsoft.com/flo...x-and-the-clr/

The garbage collector in Dynamics Ax is very simple: it collects all unreferenced object every
3 seconds (ok, this is a little bit simplified, but it’s pretty much what the GC does).
Consequently you know when the object is collected: about every 3
seconds and if this doesn’t happen you can use the Form SysHeapCheck
to create a dump of the current heap, so you know how many references
are currently held to that object.

Another point that differentiates X++ with C# is the existing of a destructor.
In X++ this destructor is called "finalize()". As described on Msdn:

X++ objects are destructed automatically when there are no more references to them.
You can destruct them explicitly in the following ways:
- Use the finalize method.
- Set the object handle to null.

In X++ it's the finalize method that contains all code that is used to clean up
the instance (releases all objects that are held by this instance, ...).
In C# this is done by the Dispose() method, but I'll describe this later.
An important point is mentioned in the Msdn documentation
(
http://msdn.microsoft.com/en-us/libr...74(AX.10).aspx
https://web.archive.org/web/20130517...8AX.10%29.aspx
https://docs.microsoft.com/en-us/dyn...ectedfrom=MSDN
):

Use finalize carefully. It will destruct an object even if there are references to it.
Из него следует что в каких-то случаях сборщик мусора в аксапте может отставать на 3 секунды. Т.е. теоретически для каких-то сценариев объект может пожить до убийства сборщиком 3 секунды. Но все равно это не объясняет наших мытарств, так как тут и 6 минут ждали и все равно не всегда ресурсы высвобождались.

Вероятнее всего это какой-то глюк в ядре аксапты, воспроизводимость которого зависит от ряда (неизвестных) случайных факторов. Видимо поэтому он и не исправлен до сих пор.