Jump to content
The simFlight Network Forums

Recommended Posts

        Dim FSUIPCAirspeed As Offset(Of UInteger) = New Offset(Of UInteger)(&H2B4)
        Dim FSUIPCPositionSnapShot As FsPositionSnapshot
        Dim AirspeedKnots As Double

        While True And FSUIPCConnection.IsOpen = True
            FSUIPCPositionSnapShot = FSUIPCConnection.GetPositionSnapshot
            FSUIPCConnection.Process()
            AirspeedKnots = FSUIPCAirspeed.Value / 65536 * 3600 / 1852
            Console.Clear()
            If FSUIPCConnection.IsConnectedToWideClient = True Then
                Console.WriteLine(String.Format("Connected to {0} via WideFS (Client {1}, FSUIPC {2})",
                                                FSUIPCConnection.FlightSimVersionConnected.ToString,
                                                FSUIPCConnection.DLLVersion.ToString,
                                                FSUIPCConnection.FSUIPCVersion.ToString))
            Else
                Console.WriteLine(String.Format("Connected to {0} (Client {1}, FSUIPC {2})",
                                                FSUIPCConnection.FlightSimVersionConnected.ToString,
                                                FSUIPCConnection.DLLVersion.ToString,
                                                FSUIPCConnection.FSUIPCVersion.ToString))
            End If
            Console.WriteLine(String.Format("    Position: {0},{1}",
                                            FSUIPCPositionSnapShot.Location.Latitude.DecimalDegrees.ToString("0.000000"),
                                            FSUIPCPositionSnapShot.Location.Longitude.DecimalDegrees.ToString("0.000000")))
            Console.WriteLine(String.Format("    Altitude: {0} ft",
                                            FSUIPCPositionSnapShot.Altitude.Feet.ToString("0")))
            Console.WriteLine(String.Format("Ground Speed: {0} kts",
                                            AirspeedKnots.ToString("0")))
            Console.WriteLine(String.Format("True Heading: {0}" & Chr(176),
                                            FSUIPCPositionSnapShot.HeadingDegreesTrue.ToString("0")))
            Threading.Thread.Sleep(125)
        End While
        FSUIPCAirspeed.Disconnect()
        FSUIPCPositionSnapShot = Nothing

 

After a while, I am getting a ERROR #15 calling FSUIPCConnection.Process().  I'm at a bit of a loss where the memory is going here... 

FSUIPC = 5.131

FSUIPC Client DLL = 3.1.3.302

 

Share this post


Link to post
Share on other sites

Added the below:

            Console.WriteLine(FSUIPCConnection.Statistics().ConnectionOpenFor.ToString)
            Console.WriteLine(FSUIPCConnection.Statistics().ProcessCount.ToString)
            Console.WriteLine(FSUIPCConnection.Statistics().ProcessLast.FsuipcMemoryFilePercentFull.ToString)

I can clearly see the FsuipcMemoryFilePercentFull increasing gradually until it eventually reaches 100%.

Commenting out all references to taking the PositionSnapShot, and not calling the GetPositionSnapshot, I can see that the FsuipcMemoryFilePercentFull does not increase any more.

Is there a leak in GetPositionSnapshot perhaps?

Share this post


Link to post
Share on other sites
Quote

Is there a leak in GetPositionSnapshot perhaps?

Yes there was. One of the internal offsets wasn't getting removed.

Thanks for the report.

I've just uploaded 3.1.5 to NuGet which should fix this.

Paul

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.