1 Reply Latest reply on May 11, 2013 5:33 PM by Alex Keh - Product Manager-Oracle

    Dispose OracleAQMessage payload

    Slawek Rosiek
      Hi,
      I have the following code:

      {
      OracleAQMessage aqMessage = queue.Dequee(this.dequeueOptions);
      OracleXmlType payload = (OracleXmlType)aqMessage.Payload;

      // processing message
      }

      I noticed that OracleXmlType is disposable so should be disposed. Who is responsible for call Dispose method on OracleXmlType? My code or maybe Oracle provider already do that? If so, when does it do that? I think that this should be described in documentation.
        • 1. Re: Dispose OracleAQMessage payload
          Alex Keh - Product Manager-Oracle
          Your code is responsible for calling Dispose on OracleXmlType or any other .NET object. If you don't, the GC does free these resources eventually. However, the GC will be slower releasing resources than an explicit Dispose call. The GC doesn't know exactly when your application ceases to use an OracleXmlType instance.

          How Dispose method works and why it should be called is the same across all .NET objects and Microsoft documents it well. In general, the ODP.NET documentation will not overlap with these fundamental Microsoft .NET concepts that are already documented.