Pre loader

Tag: Memory

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
304 views

I’m creating a web application in which I have a little bit over a million data points. When toggling annotations (about 4000) on one of my charts I noticed the memory usage of Chrome was doubled. I did some tinkering and found out this behaviour only occurred when I had “strokeDashArray” set in my VerticalLineAnnotations.

  for (let i = 0; i < 5000; i++) {
    const line = new VerticalLineAnnotation({
      x1: i,
      strokeDashArray: [5, 5] //If this is removed then the memory usage drops
    });

    sciChartSurface.annotations.add(line);
  }

Is there a known memory problem with dashed lines or anything I might do wrong?

1 vote
2k views

Good evening. Lately I’ve been troubleshooting a problem with page memory usage increasing. Over time, the memory grows exponentially and reaches several gigabytes. To explain the problem, we need to describe how we use charts:

On our website in real time, depending on our algorithm, the charts replace each other. The user constantly sees 4 charts, which are constantly replaced by others. Adding new charts occurs unnoticed by the user and only after the graph is fully loaded and drawn does it replace the previous one. That is, the user actually sees 4 charts, but there may be more on the page. After replacing the desired chart, the old one is deleted using surface.delete() and removing all dependencies.

At first, when creating a chart, I used the create() method. After a number of attempts to avoid memory accumulation and re-reading the documentation, I came to the conclusion that it is possible, since all graphs are created using create() – they have a common wasm and since there cannot be a situation in which all charts will be deleted (at least 4 are always present ), then wasm memory is not freed. Tell me if I’m right about this.

Afterwards, I decided to try to create charts using createSingle() with a reliable method, which now, since each graph has its own wasm, memory will be freed. Perhaps this was the case, but I can’t say for sure, because now after some time the page began to reload automatically with the appearance of an error, the screenshot of which I attached. This is most likely due to a wasm limitation on the page when using createSingle. Although it’s strange, when you delete the chart, the amount of wasm should decrease. And even with a limit of 16 copies, this should be enough. Please explain this error to me as well, perhaps the problem with rebooting can be somehow solved by you (I’m not sure that this should happen)

Thank you very much in advance for your answer. Have a good day!

1 vote
2k views

Hello,

I want to render a base64 image in ScichartJS without actually rendering it in DOM. I saw that you have these guides in WPF:
https://support.scichart.com/index.php?/Knowledgebase/Article/View/17213/34/
https://www.scichart.com/documentation/win/current/webframe.html#Screenshots,_Printing_and_Export_to_XPS.html

However it is difficult to achieve it in Typescript. Is there a guide or any ideas on how to do it? I would appreciate any answer.

  • Zino As asked 11 months ago
  • last active 11 months ago
1 vote
7k views

I have a big problem with memory, i try many things but it’s doesn’t effect.
It’s my code for testing memory :

    const { wasmContext, sciChartSurface } = await SciChartSurface.create("bandTest", { theme: new SciChartJSLightTheme() });
    sciChartSurface.title = "Axis 1";
    sciChartSurface.xAxes.add(new NumericAxis(wasmContext, { axisTitle: "Column number", axisTitleStyle: {fontSize: 12} }));
    sciChartSurface.yAxes.add(new NumericAxis(wasmContext, { axisAlignment: EAxisAlignment.Left, axisTitleStyle: {fontSize: 12} }));
    setTimeout(sciChartSurface.delete(),2000);

sciChartSurface.delete() have no effect for memory
I run snapshot without this code and another snapshot with this code. (snap 14 is before call SciChart and snap 15 is after call the code bellow)

What can I do?

Regards

1 vote
6k views

I am facing the following two issues related to application crash and unable to perform 3d object rotation in release mode.

Issue 1: Application Crash
I am using PointLineRenderableSeries3D object to render the Data series points.
I have a timer which ticks every 1 sec and have new data series points with some rotation of previous values.
Hence will try to add new points on every 1 sec to the same object data series

timer1.tick +=(() => {
// rendererUpdate is object of PointLineRenderableSeries3D

        using (rendererUpdate.DataSeries.SuspendUpdates()) 
            {
              var newData = GetNewPointsWithRotation( rendererUpdate.DataSeries, 30);//30 is angle of rotation for older points
                rendererUpdate.DataSeries = newData;
            }

}

Issue 2: When i run the application in release mode, i am unable to perform manual rotation using mouse dragging for the 3d sphere FreeSurfaceRenderableSeries3D object SurfaceMesh referred in the code.
When the application is running in release mode , i tried to drag rotate the 3d shape, but the 3d object is not responding to the mouse drag event (Press hold mouse left button and drag).

The attachment contains the wpf code (xaml and cs) in the same file.
Code refers .jpg file, Please refer any local jpg file to repro the issue.

Please suggest the possible reasons and fixes of the same.
Please provide the possible insights of the same.

1 vote
7k views

Memory leak in Fifo mode with Visual Xccelerator Engine enabled.

Two screenshots with Visual Xccelerator Engine enabled and disabled.
In a real application, the behavior is repeated. GS.Collect does not solve the problem.

It looks like the problem occurs on the integrated video card. AMD. When switching to a discrete video card. Memory is stable.

0 votes
3k views

Recently a customer asked us on a support ticket:

We are trying to free the memory used by SciChart but it seems like
there is a large amount of memory still held somewhere in the code.
Attached

Bug scenario:

  1. Run the 50-Channel EEG Example
  2. Start the UI, With task manager memory usage is around 40 MB.
  3. Press Run, memory usage increase to ~130 MB.
  4. Press Stop, memory usage remains the same (around 130 MB).
  5. Call the garbage collector manually, on the second call of the garbage collector the memory stays above 100 MB.

How can we release the memory allocated by a DataSeries in SciChart WPF?

0 votes
7k views

With fifocapacity(XyDataSeries), memory behaves like an image. (Repeat ups and downs)
Is this due to fifocapacity(XyDataSeries)?

Capture : x = minutes , y = MB

1 vote
8k views

SciChart is creating too much garbage objects/events* instead of reusing through pools (Analysis through dotMemory shows this). In complex applications this additional gc-pressure causes frequent lockups. (GC Pauses in 50-250ms+ range).

Top backtraces for GC-Problem:
– WeakEventTable.Purge
– Tick Rendering (TimeSpan, Strings)
– ProperyChangedEventManager.Purge

Top Types:
– WeakEventTable+EventKey
– HybridDictionary
– Double, String, TimeSpan
– Action

All of these top types/backtraces result directly from SciChart as we cross-verified with your 2D-Chart-Realtime-Series demo and by omitting the SciChart controls from our application. ( 2/3 of the total memory pressure comes from SciChart with even just 2 charts being present in our application, we see 5MB garbage memory traffic per 2 second, resulting in very frequent GC collections sporadically spiking into a high duration)

We currently use SciChart WPF V5, it seems SciChart WPF V6 Demo didnt fix this instead just using the LowLatency GC mode causing more frequent GC-collections causing worse overall performance in complex applications. (as we verfied in our application)

Is there plans to increase memory/object reuse/pooling and reduce events/actions? (70k allocations of events/actions for short time spans arent really understandable). What are those 70k events for simply rendering a chart with not much changing, see the attached image.

What settings/methods do you recommend to lower the Memory Pressure/WeakEvents resulting from SciChart usage?

What is the best rendering method to minimize GC pressure, we only require updates if new data becomes available through our application. Would it be manual?

Please comment

Thank you

0 votes
11k views

Is there an efficient way to append a subset of an array to a DataSeries? Manually looping with Append is slow (as expected). Iterating over an IEnumerable introduces overhead. I’ve read in the performance tips and tricks section that “Arrays have the biggest impact as these can be indexed using unsafe code”. The help documentation doesn’t list an Append overload specifically for an array so I assume the type is checked within the method.

I am reusing arrays whenever possible; however, my arriving data is not always the same length. In order to reduce allocations and garbage collection, I make use of Memory, Span, and ArraySegment elsewhere in my project. This allows me to pool and reuse memory. I have not found any DataSeries.Append overloads that would accept any of these types or otherwise allow me to specify the usable range of the array. Please let me know if I’ve overlooked something.

Thank you.

0 votes
6k views

Hi, I want to know buffer structure of 2d fastline.

I use very huge data per line.(maybe about 30,000 points/1 sec are appended to a line.)

But Memory usage is different than expected.

I use fifocapacity, and It is realtime graph.

Appending data, the memory usage increases too much.

Especially, It use more memory when drawing more lines.

For example,
Assuming one line uses 100mb, the five lines use 5000mb not 500mb.

Is it right??

  • CholJin Ko asked 5 years ago
  • last active 5 years ago
0 votes
15k views

Hi,
I am drawing real-time chart(512 points per second/ 1 line).
My memory usage shape is like a serrated shape…
I just want to use a certain amount that I set.

Is there any solution or option??

  • CholJin Ko asked 6 years ago
  • last active 6 years ago
1 vote
11k views

Hi

I have come across that Android Scichart consuming a lot of memory while drawing it on the surface. It increase more with the time. When i run the android memory profiler, i find out 60-65 % memory consumed by the Graphics only. The app getting started hangs after some time and become unresponsive. Please let me know how to improve the memory utilization.

0 votes
7k views

Hi,

I´ve encountered following problem. My application should visualize variables of a machine. The user can select those variables an organize them in goups. For each group a SciChartSurface should be visualized with the selected variable as DataSeries.

Therefore I created a ViewModel for those groups. Holding them in a ObservableCollection wich is bound to an ItemsControl:

<ItemsControl
        Grid.Row="1"
        Grid.Column="1"
        Grid.ColumnSpan="6"
        HorizontalContentAlignment="Stretch"
        VerticalContentAlignment="Stretch"
        PreviewMouseWheel="XAxis_MouseWheel"
        PreviewMouseUp="ListView_OnMiddleMouseUp"
        d:PreviewKeyDown="ListView_OnPreviewKeyDown"
        d:PreviewKeyUp="ListView_OnPreviewKeyUp"
        ItemsSource="{Binding ChartViewModels}"
        >
        <ItemsControl.ItemsPanel>
            <ItemsPanelTemplate>
                <UniformGrid Columns="1"/>
            </ItemsPanelTemplate>
        </ItemsControl.ItemsPanel>
        <ItemsControl.ItemTemplate>
            <DataTemplate DataType="traceControl:ChartViewModel">
                <Grid
                    HorizontalAlignment="Stretch"
                    VerticalAlignment="Stretch"
                    >

                    <s:SciChartSurface Loaded="ChartSurface_Loaded" 
                                       Unloaded="ChartSurface_Unloaded"
                                       Background="White"

                                       >

                      <!-- Some other stuff is also in here, modifiers and axissetup -->

                    </s:SciChartSurface>
                </Grid>
            </DataTemplate>
        </ItemsControl.ItemTemplate>

    </ItemsControl>

There is a Refresh-Action. It does clearing the the ViewModel Collection and creating new ViewModels depending on the configuration and fill them in the ViewModel Collection.

If both actionparts (clearing and filling data) were executed together in for example the ICommand of a button, the memory footprint is increasing each time the refresh button is hit.

If the actionparts were executed one by one, e.g. a clear button and a fill button, everything is fine.

Do I miss something?

Thanks in advance!

Markus

p.s. I was not allowed to add Screenshots of dotMemory

0 votes
10k views

The issue I’m having is that I seem to be running out of memory for 3D charts after a certain data size. What I will see is either my chart never renders at all or on occasion the entire application will crash (due to accessing out of bounds memory in the native dlls.)

I am using a SurfaceMeshRenderableSeries3D with a UniformGridDataSeries3D(int, float, int). With smaller sizes such as 320×240 (X,Z) I get results, but larger sizes such as 640×480 (X,Z).

This issue only seems to happen when compiling to 32-bit. I have seen the other questions regarding how AnyCPU is compiling to 32-bit. Some of our customers have to use 32-bit so I would like to know what the expected footprint is to hopefully try and work around it.

Thanks!

0 votes
11k views

Hi,
some time ago we update our application used WPF chart v 3.1 to version 4.2.2.9744. Now we realize that the application uses much more memory as before, sometimes it doubles the memory usage. The worst issue is that memory is not release aver after unloading the data series and even after closing the Tab which contains the Chart. Because we need to deploy the Application even on pc with 2 GB RAM it becomes an issue for us. Please advise what could we check to make sure memory will be released after unloading the data series and closing the tab with chart.

0 votes
15k views

Is there a way to make a screenshot from a chart without drawing the chart on screen?

I am making an application that will send an E-mail with alot of extra info, one of the attachements is a chart.
The application is running in a Windows service, so showing the chart to take a screenshot is not the way to go.

When I am sending the email I want to take the following steps:

  1. Get the data
  2. Render the data in memory (not on screen).
  3. Create an image of the chart.
  4. Include this image in my E-mail.

Can someone tell me if this is a possibility and how I can do this?

  • Kevin Goos asked 7 years ago
  • last active 7 years ago
1 vote
7k views

I am testing scichart and want to plot as much data as possible on a memory constrained system.

Our data is equi-time with no gaps in any of the series. It seems very memory wasteful to have to store an x value per data point per series when these could just be directly infered from the index of the point, this would allow memory usage to be halved.

Is it possible to achieve something similar to this in scichart.

Side question if I have a number of series that all share x values is it possible to use one set of x data for multiple series without it being duplicated in memory.

  • Hugoagogo asked 8 years ago
  • last active 8 years ago
0 votes
0 answers
11k views

Have a good day!

We are working with scichart render context to create 2d sprite. We have already optimized our code, but there is still problem.
When we put annotation, where we bind our image, outside the function, the image stops rendering. We’ve made that you had told us to do in previous post
( https://www.scichart.com/questions/question/memory-usage-part-2 ), but it doesn’t make a sense. We’ve found out that when we create
this annotation inside the function and when we pan the image it takes too many memory resources. It is caused by creating many annotations of this type
and therefore there is queue to the garbage collector. That’s why our goal is to put this annotation outside the function and just change image that is binded
to the annotation. Is there any way to solve it?

Code snippets:

Annotation outside the function (image shows, but doesn't render, it takes less memory)

        BackgroundImageAnnotation backgroundImage = null;

        private void OnRedrawWellSection(object sender, IRenderContext2D e)
        {
            e.Clear();
            e.SetPrimitvesCachingEnabled(false);
            double density;                        
            double density1;                        
            var minThltest = (double)SciChartSurface.XAxis.VisibleRange.Min;
            var maxThlTest = (double)SciChartSurface.XAxis.VisibleRange.Max;
            var minTvdTest = -2000;
            var maxTvdTest = -700;
            var xCalc = SciChartSurface.XAxis.GetCurrentCoordinateCalculator();
            var yCalc = SciChartSurface.YAxis.GetCurrentCoordinateCalculator();

            density = SciChartSurface.GridLinesPanel.Height/(double) SciChartSurface.YAxis.VisibleRange.Diff;

            density1 = SciChartSurface.GridLinesPanel.Width/(double)SciChartSurface.XAxis.VisibleRange.Diff;

            using (SciChartSurface.SuspendUpdates())
            {
                if (backgroundImage == null)
                {
                    backgroundImage = new BackgroundImageAnnotation
                    {
                        CoordinateMode = AnnotationCoordinateMode.Relative,
                        X1 = 0,
                        Y1 = 0,
                        AnnotationCanvas = AnnotationCanvas.BelowChart,
                    };
                }

                var mainWindow = Application.Current.MainWindow;
                var source = PresentationSource.FromVisual(mainWindow);
                if (source == null || source.CompositionTarget == null) return;

                var width = (int)SciChartSurface.ActualWidth;
                var height = (int)SciChartSurface.ActualHeight;
                if ((int)SciChartSurface.ActualWidth == 0)
                    width = 1;
                if ((int)SciChartSurface.ActualHeight == 0)
                    height = 1;
                WriteableBitmap writeableBmp = BitmapFactory.New(width, height);
                var color = Colors.Blue;
                for (double i = minTvdTest; i < maxTvdTest; i=i+density)
                {
                    var t1 = (int) xCalc.GetCoordinate(minThltest);
                    var t2 = (int) yCalc.GetCoordinate(i);
                    var t3 = (int) xCalc.GetCoordinate(maxThlTest);
                    var t4 = (int) yCalc.GetCoordinate(i);
                    if (i<-1500)
                    {
                        color = Colors.Green;
                    }
                    else
                    {
                        if (i<-1000)
                        {
                            color = Colors.Red;
                        }
                        else
                        {
                            color = Colors.Orange;
                        }
                    }
                    writeableBmp.DrawLineBresenham(t1, t2, t3, t4, color);
                }
                backgroundImage.ImageSource = writeableBmp;
                var sprite = e.CreateSprite(backgroundImage);
                e.DrawSprite(sprite, new Rect(0, 0, width, height), new Point(0, 0));
                e.Layers.Flush();
                writeableBmp = null;
                backgroundImage.ImageSource = null;
                e.DisposeResourceAfterDraw(sprite);
            }
        }

Annotation inside the function (image shows, renders, but when we pan, it takes many resources and it doesn’t invoke destructor at once)

// We put the declaration of annotation in the function scope
// BackgroundImageAnnotation backgroundImage = null;

private void OnRedrawWellSection(object sender, IRenderContext2D e)
{
    e.Clear();
    e.SetPrimitvesCachingEnabled(false);
    double density;                        
    double density1;                        
    var minThltest = (double)SciChartSurface.XAxis.VisibleRange.Min;
    var maxThlTest = (double)SciChartSurface.XAxis.VisibleRange.Max;

    ...

    using (SciChartSurface.SuspendUpdates())
    {

        BackgroundImageAnnotation backgroundImage = null;
        if (backgroundImage == null)
        {
            backgroundImage = new BackgroundImageAnnotation
            {
                CoordinateMode = AnnotationCoordinateMode.Relative,
                X1 = 0,
                Y1 = 0,
                AnnotationCanvas = AnnotationCanvas.BelowChart,
            };
        }

        var mainWindow = Application.Current.MainWindow;
        ....
  • Egor asked 9 years ago
0 votes
12k views

Hello again!
In addition to the ticket https://www.scichart.com/questions/question/memory-usage-1

I’ve modified my project to run faster. I’ve put BackgroundImageAnnotation, from which we create sprite, outside the function. But when I run the application, the image freezes and doesn’t redraw.
What is the reason? And how can I fix it?

I’ve attached modified project below.
Link: https://yadi.sk/d/TSsZuDTbipP7y

  • Egor asked 9 years ago
  • last active 9 years ago
0 votes
14k views

In my application I remove lines from SciChartSurface, but Resharper still shows that data not removed from memory.
How completely remove from memory, that GC would collect it?

Edited:

I found smth strange, don’t even know if it’s my issue or not.
The structure shows what keeps my data alive.

using (sciChart.SuspendUpdates())
                {
                    for (var i = 0; i < pavadinimai.Count; i++)
                    {
                        if (pavadinimai[i] != null)
                        {
                            this.Dispatcher.Invoke((Action)(() =>
                            {
                                var sarasas = new List<Duomenys>(LinijuSarasas);
                                var line = sarasas.SingleOrDefault(p => p.Linija.Name == pavadinimai[i]);
                                try
                                {
                                        string pavadin = pavadinimai[i];
                                        var Ynauj = Ynauji[i].Select(p => (double)p).ToList();
                                        line.XyAsiesTaskai.Append(Xnauji, Ynauj);
                                }
                                catch (Exception e)
                                {
                                    MessageBox.Show(e.ToString());
                                }
                            }));
                        }
                    }
                }

And

var asis = asiesNr.ToString();
            using (sciChart.SuspendUpdates())
            {
                for (var i = 0; i < YdtSeries.Count; i++)
                {
                    if (pavadinimai[i] != null)
                    {
                        var dataSeries = MasyvasIXySeries(XdtSeries, YdtSeries[i], pavadinimai[i]);
                        var rnd = new Random().Next(0, 10);
                        var Fast = new FastLineRenderableSeries() { SeriesColor = spalvuMasyvas[i], DataSeries = dataSeries, Name = pavadinimai[i], YAxisId = asis, StrokeThickness = 1 };
                        PridetiLinijaPrieSaraso(dataSeries, asiesNr, asis, Fast, true, false);
                        sciChart.RenderableSeries.Add(Fast);
                        //sciChart.ZoomExtents();
                    }
                }
            }
0 votes
21k views

Have a good day.

I’m working with scichartsurface, where I’m drawing a lot of lines with the help of IRenderContext2D. I’ve found out that this way of drawing took too much memory. For example when I displayed only surface, it took only ~80 Mb (Image 1), but when I displayed the graph using checkbox, began to scroll and pan my graph, the usage of memory increased to ~160 Mb (Image 2).
What is the reason of such behaviour?

Thanks in advance

I’ve attached the project: https://yadi.sk/d/cYP6RFVXhfjRS

  • Egor asked 9 years ago
  • last active 9 years ago
Showing 22 results