InCollect() Deprecated

This forum is meant for questions and discussions about the X# language and tools
Post Reply
JoeD
Posts: 10
Joined: Wed Apr 09, 2025 12:59 pm
Location: Deutschland

InCollect() Deprecated

Post by JoeD »

Hi everyone,

I get a lot of warnings like:
'XSharp.RT.Functions.InCollect()' is obsolete: ''InCollect()' is not supported'

This is related to code like the following:

Code: Select all

        
IF .NOT. InCollect()
    UnRegisterAxit(SELF)
    SELF:oSomeObject := NULL_OBJECT
ENDIF
Is there any documentation on what this method actually does and how it should be replaced?

Also, are there any implications or side effects I should be aware of when simply removing this check?

Thank you
Johannes
User avatar
wriedmann
Posts: 4017
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Re: InCollect() Deprecated

Post by wriedmann »

Hi Johannes,
InCollect() in X# does nothing because the VO garbage collector is not present anymore - X# uses the .NET memory managment and the relative garbage collector (that is much more stable and fast).
InCollect() in VO checks if the garbage collector is currently running and doing his work.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
robert
Posts: 4882
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Re: InCollect() Deprecated

Post by robert »

Johannes,
This function always returns FALSE in X#:
See:

https://github.com/X-Sharp/XSharpPublic ... GC.prg#L52

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
JoeD
Posts: 10
Joined: Wed Apr 09, 2025 12:59 pm
Location: Deutschland

Re: InCollect() Deprecated

Post by JoeD »

Thank you, Wolfgang and Robert, for the information and for pointing me to the location in the source code.
I suppose I could have thought of checking the source myself.

I’ll go ahead and remove the checks then.

Best regards,
Johannes
Post Reply