Testing CGraphic - questions and suggestions - page 7

 

debugging each function can locate the problem properly and set a task in the SD

there seems to be an error in canvas size calculation a gigabyte canvas is trying to recreate

or a huge array is created in some kind of loop

 
o_o:

debugging each function can locate the problem properly and set a task in the SD

there seems to be an error in canvas size calculation a gigabyte canvas is trying to recreate

Or it creates a huge array in some kind of loop


More like this: "...creates a huge array in some kind of loop", as I've definitely seen an array of 300 elements LIVE on the RAM. While the laptop was "breathing" I managed to see 5GB.

The problem is only floating - at least put video recording of what happens on screen - to catch which combinations lead to fatal results.

 

it didn't play for me

...
      CCurve *curve_b=my_graphic.CurveAdd(arrX,arrY,CURVE_LINES,"Close");
      CAxis *xAxis=my_graphic.XAxis();           // получаем ось X
      //---попеременно комбинирую (комментировать, раскоментировать) строки 87
      //--- и 88 можно словить момент поглощения памяти и зависания компьютера
      //xAxis.AutoScale(false); 
      //xAxis.Type(AXIS_TYPE_DATETIME); 
->    my_graphic.CurvePlotAll();
      my_graphic.Update();
...


 
o_o:

I can't reproduce it.



I don't have a clear playback either. I just saw this:

      for(int i=0; i<size;++i)

Isn't that the problem?

 
No, it's the other way round.)
 
o_o:
No, it's good on the contrary )

It makes no difference. A normal compiler should do these optimizations itself.

Judging by the description, we have a suspicion that the problem is with a memory leak and maybe not in the code at all.

 
o_o:
No, it's the opposite of good )

Fixed it to the usual i++ and compiled more expanded code = 5GB again :). I'll give the code later, while we're hovering...
 
Vladimir Karputov:


This is more likely: "...creates a huge array in some kind of loop", as I've definitely seen an array of 300 elements CAUSING RAM. While the laptop was "breathing" I managed to see 5GB.

The problem is only floating - you might as well put a third-party camera video of what's happening on the screen - to catch which combinations lead to a fatal result.

Afternoon!

The reason for the hang-up is disabling of auto-stitching: xAxis.AutoScale(false)

In this case you have a very large range of values stored in the arrX array:

double MAX = arrX[ArrayMaximum(arrX)]; // 1497438000.0
double MIN = arrX[ArrayMinimum(arrX)]; // 988653600.0

And you don't change the value of the step to split the axis when putting the signature my_graphic.XAxis().DefaultStep(), and since it is 25.0 by default, the number of signatures the library tries to generate is equal:

m_xsize=(int)MathRound((max-min)/step)+1; // 20351377

Which leads to a hang, there are two options:

  1. To leave the autostrobbing.
  2. Pass an adequate value to my_graphic.XAxis().DefaultStep() method, to change the default step (I got a value of 50878800.0 for a 10-part split)
 
Vladimir Karputov:

Fixed to familiar i++ and compiled more expanded code = 5GB again :). I'll give the code later, while hanging...


Somewhere in here:

The dog's in here somewhere

trouble. I'm only spoiling these lines.

Files:
 
Roman Konopelko:

Good afternoon!

The cause of the hang-up is disabling auto-stepping: xAxis.AutoScale(false)

You have a very large range of values stored in the arrX array:

And you don't change the value of the step to split the axis when putting the signature my_graphic.XAxis().DefaultStep(), and since it is 25.0 by default, the number of signatures the library tries to generate is equal:

Which leads to a hang, there are two options:

  1. To leave the auto-attachment.
  2. Pass an adequate value to the my_graphic.XAxis().DefaultStep() method, to change the default pitch (I got a value of 50878800.0 for a 10-part split)


Thanks! Cut (removed) the lines with AutoScale and with the step setting in general.


And immediately a wish: I can make a slanted (angled) font for both axes at once (my_graphic.FontSet("Arial",10,0,180);). Can't we make this font (or angle) setting method for a separate axis?

Files:
Reason: