Errors, bugs, questions - page 1336

 

Is that the whole problem because of 24 bytes? Sorry, are you trying to write MT software on a calculator :) ?

Of course, I apologize, but by sucking the problem out of your fingers, you are blocking other people's questions, which are rarely noticed by representatives of developers.

 
Alexey Navoykov:

So, why shouldn't the destructor be optimized? We have to store extra 8 bytes just because of it...

Well, I just don't know how it's implemented there. For example, if you have an array of objects:

Are references (pointers) for each element stored in the system?

But you can't take a pointer to a structure and that reduces the convenience of using it. That's why you have to make a painful choice sometimes... If you managed to reduce the class size, that would be wonderful. And if you have a pointer to the structure too, everything will be fine.)

Create objects dynamically, with the new operator, and you don't have to create empty objects at all.

The structure cannot be referenced by a pointer, but the structure can be passed by reference, for example: OrderSend(MqlTradeRequest& request, MqlTradeResult& result) - in most cases, this is enough.

 
Konstantin Karpov:

Is that the whole problem because of 24 bytes? Sorry, are you trying to write MT software on a calculator :) ?

Of course, I apologize, but by sucking the problem out of your fingers, you are blocking other people's questions, which are rarely noticed by representatives of developers.

Learn what arrays are for starters.
 
Alexey Navoykov:
You'd better study arrays for starters.

Well, I studied them a few years ago :) if you put class objects in an array, then create a list of pointers and create class objects in the "heap", you were rightly told about new operator...

All the data I have is very big and is originally handled by class objects, located in the "heap". My PC has 8 gigs of memory and I can totally use this memory, even one time I made a mistake in the algorithm and memory leaked, the memory was clogged to 95% and then the operating system started cleaning everything up by itself.

So you'd better not play the offended boy, but look through all the features of the language and you will succeed :)

 
Vasiliy Sokolov:

Create objects dynamically using new operator, and you don't have to create empty objects at all.

The structure cannot be referenced by a pointer, but the structure can be passed by reference, for example: OrderSend(MqlTradeRequest& request, MqlTradeResult& result) - in the vast majority of cases this is enough.

What's the point of this advice? You seem to have read it only through a line and wrote something as soon as possible. We are talking about the size of the class. This size does not depend on how the object is created, statically or dynamically. And "create empty objects" - I don't understand what I mean at all. And passing arguments into functions is absolutely out of place here too. Do you think we are little children who don't know how objects are passed into functions?

 
Konstantin Karpov:

Well, I studied them a few years ago :) if you put class objects in an array, then create a list of pointers and create class objects in a "heap", you were rightly told about new operator...

All the data I have is very big and is originally handled by class objects, located in the "heap". My PC has 8 gigs of memory and I can totally use this memory, even one time I made a mistake in the algorithm and memory leaked, the memory was clogged to 95% and then the operating system started cleaning everything up by itself.

So, you'd better not play the offended boy, but look through all the possibilities of the language and you'll get it all :)

Another smart guy... He started with calculators and now he doesn't care about 8 gigs. About pointers and heap - what's the point of your brilliant knowledge? Did anyone here ever ask what pointers are? Or is it just a chat about life?

In general, guys, please convincingly ask you to post in some other thread, please, no one asked for your advice here. The dialogue is specifically with the developer.

 
Alexey Navoykov:

What's the point of this advice? It's as if you've read it from a line and couldn't wait to write something. We're talking about class size. This size doesn't depend on how the object is created, statically or dynamically. And "create empty objects" - I don't understand what I mean. And passing arguments into functions is absolutely out of place here too. Do you think we are little children who don't know how objects are passed into functions?

Listen, smart guy, go learn the basics of programming first in memory-managed environments: you were clearly given the answer that a class, even an empty one, contains certain meta data. Their size and organization is optimal. Who are you to teach developers how to write a compiler and store data correctly!? If you want to save some bytes, go build your bicycle in C or Assembler.

There's a lot of smart guys who read "C for Beginners" and then give you advice.

 
Alexey Navoykov:

Another smart guy... He started with calculator, now he doesn't care about 8 gigs. About pointers and heap - why this brilliant knowledge of yours? Did anyone here ever ask what pointers are? Or is it just a chat for life?

In general, guys, convincingly ask you to flood in some other thread, please, nobody asked your advice here. The dialogue is specifically with the developer.

Judging by your statements, you work with arrays of class objects, which are so numerous that their sheer size fills the memory of the terminal, that it must be terribly slow, otherwise you wouldn't have raised this question. I think that you have strategically chosen wrong approach to work with your data and you've been given a lot of advice about it:

- allocate memory for your objects in the "heap" and the terminal memory will not be clogged

- do not keep large amounts of information in memory and upload the data to disk to save it from accidental loss in case of a crash - you can also upload it programmatically if necessary

And aggravate themselves with advice is not worth it, if you want to communicate only with the developer, there is a service Desk, but there are many people here :)

 
Renat Fatkhullin:
I have a question - how much memory is allocated by the terminal (MT4, MT5x86 and MT5x64) for EAs?
 

The developers are not humourless.

Sounds to me like a download, and a "Download" sort of tree swing to the right or left.