EA using a DLL: Memory Consumption

 
Simha:

B"H


Hello,


Upon running my EA (which makes use of a single self-developed DLL) on a single symbol, the memory consumption of the MT4 terminal (terminal.exe) is raised by ~100[MB].

Running the same EA on another symbol (additionally) increases terminal's memory consumption by ~100[MB] more.

And so on... Memory consumption is raised by ~100[MB] for every additional symbol on which this EA is operated.


DLL does not allocate more than ~0.5[MB] of memory, once, upon its loading.


How can I analyze this relatively extremely-large memory-consumption enlargement?

Are there any tools showing what consumes so much memory?


I'm aware of tools showing the contents of a running process { allocated mem., threads, mutexes, events, handles, etc... }, as the "Process Explorer",

but they're not sufficient to analyze the cause for this consumption.


Thanks much,

Simha

 
Simha:


Your DLL might rely on other DLLs, memory leak also possible, etc. It is hard to say without looking into code...
 

Build a test harness & run it under Visual Studio maybe?

IIRC There are debugging options in MSVCRT.dll to display memory leaks

 
brewmanz:

Build a test harness & run it under Visual Studio maybe?


B"H



Thanks.

Wrote a C++ application (using Visual Studio) making a same use of this DLL, as the EA I'm checking.

Its peak memory consumption - ~850[KB].


1. Any idea why does attaching the EA to a symbol consumes ~100[MB]?

2. Could you please elaborate on your second suggestion (debugging options in MSVCRT.dll)?


Thanks,

Simha

 
Simha:


B"H



Thanks.

Wrote a C++ application (using Visual Studio) making a same use of this DLL, as the EA I'm checking.

Its peak memory consumption - ~850[KB].


1. Any idea why does attaching the EA to a symbol consumes ~100[MB]?

2. Could you please elaborate on your second suggestion (debugging options in MSVCRT.dll)?


Thanks,

Simha


maybe about lot of history bars in use and maybe your ea also take prices from different timeframes?

 
EADeveloper:


maybe about lot of history bars in use and maybe your ea also take prices from different timeframes?

The EA is currently a mere skeleton wrapping the DLL. It does NOT perform any kind of trading or trading-related actions.

Is your answer still relevant for such an EA?

 

B"H



Notice: I've checked the increase in memory-consumption for another EA, which does NOT make use of any DLL. The increase is also of ~100[MB] !!

Does anyone else encounter this phenomenon?


MetaQuotes people: Any response?

{ I'm using MT4 build 229 }


Thanks,

Simha

 
looking for memory leaks via _CrtDumpMemoryLeaks() etc ...

http://msdn.microsoft.com/en-us/library/e5ewb1h3%28v=VS.80%29.aspx

 


B"H

Thanks. I'll look into that.

 
Do you load any indicators in the EA, maybe with data from different pairs and timeframes? I have one EA that is using iClose() to use prices from 7 other pairs. This alone already causes memory consumption. If I put this EA on an M1 chart (I have lots of history there) the EA alone (without loading any dll) will consume massive amounts of memory. It seems this is normal for MT4.
 
7bit:
Do you load any indicators in the EA, maybe with data from different pairs and timeframes? I have one EA that is using iClose() to use prices from 7 other pairs. This alone already causes memory consumption. If I put this EA on an M1 chart (I have lots of history there) the EA alone (without loading any dll) will consume massive amounts of memory. It seems this is normal for MT4.

B"H



As mentioned above, I run a "bare" EA, meaning: not using indicators, no history-data, not trading (i.e. not opening positions AT-ALL). An EA that does NOTHING.

Could you check and see whether this is the case on your MT4 terminal as well.


Thanks,

Simha