Pre loader

Tag: SciCharts

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0 votes
2k views

Hi,

I have a very simple iOS project in XCode 13 which uses Swift. The project has a tab bar controller with two tabs. The first tab brings up a sample home screen and the second tab initializes a blank SciChart graph.

I want to eventually be able to sometimes change what data is shown on the graph (via Bluetooth), and therefore I want to run my graph code every time the tab for the graph is selected. I put all my code for SciChart inside:

override func viewWillAppear(_ animated: Bool)

and this almost works fine, but declaring

let surface = SCIChartSurface() inside of override func viewWillAppear(_ animated: Bool)

seems to be causing some sort of memory leak. Switching between tabs often causes my app to crash and XCode reports the following error message: “Terminated due to memory issue”

Is there a better way to initialize my graph to prevent this memory leak? Or is there way to flush the “surface” variable from memory when transitioning between tabs to prevent this memory issue from occurring?

My small sample project is available here which demonstrates the memory leak when switching between the home screen tab and graph tab: https://drive.google.com/file/d/1mz88R3kKvoPqSGxFzohoHGDkseSwgHPh/view?usp=sharing

Any help greatly appreciated, thanks!

Showing 1 result

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies