ChartReDraw() increase memory usage 5.5MB?

 

When I call ChartReDraw() on a chart, it increase my memory usage 5.5MB. If I have 10 charts, then it is 55MB.

ChartReDraw() is also called by CCanvas::Update(). So if you have a CCanvas Object, then you just waste 5.5MB on nothing.

WindowReDraw() does not increase memory usage.

Is it memory leak?

 
MarkJoy:

When I call ChartReDraw() on a chart, it increase my memory usage 5.5MB. If I have 10 charts, then it is 55MB.

ChartReDraw() is also called by CCanvas::Update(). So if you have a CCanvas Object, then you just waste 5.5MB on nothing.

WindowReDraw() does not increase memory usage.

Is it memory leak?

  1. That's an assumption.
  2. Nothing is wasted
  3. That's an assumption.
  4. Only if your terminal goes over GB of usage.
  5. Just because it allocated memory means nothing. A new tick could have just as well cause that.
  6. 5.5 MB is irrelevant when your machine has multiple Gigabytes of swap. Do you panic that you are dieing of blood loss when a Mosquito takes a sip from your arm?
 
whroeder1:
  1. That's an assumption.
  2. Nothing is wasted
  3. That's an assumption.
  4. Only if your terminal goes over GB of usage.
  5. Just because it allocated memory means nothing. A new tick could have just as well cause that.
  6. 5.5 MB is irrelevant when your machine has multiple Gigabytes of swap. Do you panic that you are dieing of blood loss when a Mosquito takes a sip from your arm?


Do you understand my question?

  1. That's an assumption. --> What are you talking about?
  2. Nothing is wasted --> I am a user. To me something allocated to do nothing, it's a waste. WindowRedraw() does not increase memory usage
  3. That's an assumption. --> What are you taking about?
  4. Only if your terminal goes over GB of usage. --> Again, what are you talking about?
  5. Just because it allocated memory means nothing. A new tick could have just as well cause that. --> Copy:  I am a user. To me something allocated to do nothing, it's a waste. WindowRedraw() does not increase memory usage
  6. 5.5 MB is irrelevant when your machine has multiple Gigabytes of swap. Do you panic that you are dieing of blood loss when a Mosquito takes a sip from your arm? --> Do you even understand my question. The point is you waste 5.5MB for nothing. I you have 3billion $, shall you give me 3 million $?
 
I actually create a button, when I click on the button, it calls ChartReDraw() and my memory increase 5.5MB. The same does not happen when button calls WindowReDraw().

I actually had a hard time figure this out. I have 30 charts and my indicator create a CCanvas Object to draw the whole chart. Whenever I apply my indicator it uses 25MB. so 25*30 is 750MB.

I had the same setup on another platform (FCXM-Trading Station) but it just use 210MB. Every time I use my indicator on FXCM chart, it just increases 7MB.

So I don't know if it is my indicator is leaking memory on MT4 platform. I did some debugging and found out that:

1> With chart pixel size (1622x684) everytime I create CCanvas Object to draw the whole chart, it's allocate 18.1 MB.

2> But when I destroy CCanvas Object, it only frees 12.6MB. I though the memory leak is because of my indicator

3> But NO, IT is because of ChartReDraw() is called in CCanvas::Update(). If you think this is an assumption, you can look into CCanvas code

4> If you think ChartReDraw() increase memory usage 5.5MB is assumption then you are free to create a button and test like I did

Now resolve all the things, my indicator only use 230MB on 30 charts. Is it worth the debugging???

 

I understood you perfectly.. You saw some trivial memory allocation in response to anything. You are in the noise.  Forget it.

Every call could allocate memory.. You saw it once. WindowRedraw could also, you just didn't see it. Forget it.

Yes it is an assumption. ChartReDraw could allocate memory. WindowRedraw could allocate memory. CCanvas::Update could allocate memory. A button press could allocate memory. A new tick could allocate memory. Forget it.

It is not worth debugging. Forget it.

 
whroeder1:

I understood you perfectly.. You saw some trivial memory allocation in response to anything. You are in the noise.  Forget it.

Every call could allocate memory.. You saw it once. WindowRedraw could also, you just didn't see it. Forget it.

Yes it is an assumption. ChartReDraw could allocate memory. WindowRedraw could allocate memory. CCanvas::Update could allocate memory. A button press could allocate memory. A new tick could allocate memory. Forget it.

It is not worth debugging. Forget it.


Hahaa, You don't even do the least debugging and said it is my assumption. You are greatest coder i have ever seen!!!!!

Why button press allocate memory incase ChartReDraw  but not in case WindowReDraw? you do the test and figure out?

A new tick allocate memory is useful. ChartReDraw  allocate memory is useless.

Yeah, it is not, because it is not your indicator. 

I soon forget you when end this reply!

Thank you for your interested and useless comment!!

 
MarkJoy:


Hahaa, You don't even do the least debugging and said it is my assumption. You are greatest coder i have ever seen!!!!!

Why button press allocate memory incase ChartReDraw  but not in case WindowReDraw? you do the test and figure out?

A new tick allocate memory is useful. ChartReDraw  allocate memory is useless.

Yeah, it is not, because it is not your indicator. 

I soon forget you when end this reply!

Thank you for your interested and useless comment!!

Please calm down.

If you think it's a bug on ChartRedraw() you should write to ServiceDesk.

If you want some useful advice here, you should post some code to reproduce the issue.