Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The RELEASE service removes a JSON entity from memory. Once released, it is no longer valid. In fact, the RELEASE service sets Handle to 0 to ensure the old handle will not be used accidentally. Any JSON entity created by the NEW or PARSE services must be deallocated from memory when no longer needed. Forgetting to do this on occasion will not cause a fatal error since SRP Utilities will clean up all its memory when OpenInsight closes, but frequently failing to release entities causes memory to get used up, which can become a problem over long periods of time.

...

Code Block
// Let's create some entities.
Success = SRP_JSON(ObjectHandle, "NEW", "OBJECT")
Success = SRP_JSON(IntegerHandle, "NEW", "NUMBER", "1234567890")
Success = SRP_JSON(DecimalHandle, "NEW", "NUMBER", "123456789.987654321")
Success = SRP_JSON(StringHandle, "NEW", "STRING", "Hello, World!")
Success = SRP_JSON(BooleanHandle, "NEW", "BOOLEAN", 1)
Success = SRP_JSON(ArrayHandle, "NEW", "ARRAY")

// Don't forget to release them when we're done
SRP_JSON(ArrayHandle, "RELEASE")
SRP_JSON(BooleanHandle, "RELEASE")
SRP_JSON(StringHandle, "RELEASE")
SRP_JSON(DecimalHandle, "RELEASE")
SRP_JSON(IntegerHandle, "RELEASE")
SRP_JSON(ObjectHandle, "RELEASE")

See Also

NEWPARSE