Dynamically allocated memory and continues execution issue

 

Hello everyone.

1. Dynamically allocated arrays, objects and instances of classes may hold important data.

2. Reloading the system or bot for any reason causes interruption and loss of those data.

How do you fix this issue?

  • Do you just use the static allocation methods and avoid using Objects in general?
  • Do you use disk to store those data to recover whenever necessary?
  • Do you just prefer to use a reliable VPS to ensure continues execution?
  • Do you process historical ticks to recover those data?

I would be grateful to hear how you handle this:

  • For the freelance section customers
  • For you own use
 
There is a mistake in the above. Even statically allocated memory may hold important data that may be lost due to system restart. So it is not really a matter of statically allocated or dynamically allocated memory. The issue stays the same for both.
 

Please don't use this section to post about coding.

Topic moved to appropriate section.


If the data in memory really matters, you need to save them in all cases, using a VPS is irrelevant.

Using static or dynamic "allocation method" is also irrelevant.


 

Saving the data to the disk looks like the best option here - I'm assuming the data is produced by the EA under very specific conditions and cannot be fetched by regular MQL5 functions, like iClose, CopyClose, etc. Only the data written to the disk can be restored after a system/terminal shutdown, because all memory is freed after MT5 is restarted.

Using a VPS just to make sure the data is always available looks like an overkill solution to me.