Hello all:
Ive been using mysql for working with my EAs for some time now, I used mainly this EAX Library https://www.mql5.com/en/code/855, which I added a couple of functions and some error handlers for reconnections in case the connection gets dropped while executing a query, everything works perfectly except for one scenario when I load a lot of experts (9 at this point) on a single terminal all using this type of connection, when I restart my computer and load the terminal I would often get Access violation at 0x000000007788E4E4 write to 0x0000000000000024 and that expert will freeze there, If i close the terminal and open it back again without restarting the computer it will load without any problems, after a long research and debugging on my EAs Ive found out that this access violation will happen when the EA is trying to allocate the memory for the mysql object using the function mysql_init(), I was wondering if anyone can shed some light over here, if theres a way for me to ignore the exception and let the expert continue or if theres a workaround. Here is a little resumed code that will cause the error, am working on Windows 7 Ultimate x6, MySQL DataBase 5.1.73, libmysql 6.1.2.
Sounds as if you know what the problem is but don't know where to start..
Ive found out that this access violation will happen when the EA is trying to allocate the memory for the mysql object using the function mysql_init()
Sounds as if you know what the problem is but don't know where to start..
Ive found out that this access violation will happen when the EA is trying to allocate the memory for the mysql object using the function mysql_init()
I know that the error is happening specifically on that line, since am using the MySQL C API, I dont belive the error is being caused because of a bad DLL but by some kind of memory management done by MT5 when its loading its resources, I know this is a very specific error, but maybe someone in Metaquotes can give me a hint if its my code or if there is something I can do to fix it.
@midnightwalker0:
Have you solved this issue? I am also experiencing issues with memory allocation. I'm also using windows 7 though I have the most recent .dd release (6.1.5.0)
@midnightwalker0:
Have you solved this issue? I am also experiencing issues with memory allocation. I'm also using windows 7 though I have the most recent .dd release (6.1.5.0)
hey i've been experiencing this issue myself, once mt5 is loaded it works just fine but am getting some weird memory errors they look like memory addresses to me but am no expert programer, were you able to find a solution? please share thanks!
hey i've been experiencing this issue myself, once mt5 is loaded it works just fine but am getting some weird memory errors they look like memory addresses to me but am no expert programer, were you able to find a solution? please share thanks!
I've been having those Access Violation errors too, and I figured out how to fix them.
It happens that in many places, the type int is used to hold the value of what is actually a pointer to some structure or object belonging to the MySQL lib and that is not interpreted by MQL5, so you just store it as int for reference. However, the type int is 32-bits regardless of your architecture, and if you are using 64-bit system, the type int is not big enough to contain the value of a pointer. You have to use long instead.
Most libmysql.dll functions return pointers, such as mysql_init(), mysql_real_connect(), mysql_real_query(), etc, and most MQL5 scripts store the return value of those functions as int, an insufficient data type to represent those pointers, which is causing those problems.
I managed to get my scripts working perfectly in 64-bit environment by using long instead of int in some strategic places. Since all I really need is to insert stuff in the database, I only needed to change the functions I mentioned above.
Hey there, Its pretty much whats been happening to me, good to know am not the only one experiencing this!, Ive already submited a ticket with Service Desk hopefully ill get some kind of answer.
I've been having those Access Violation errors too, and I figured out how to fix them.
It happens that in many places, the type int is used to hold the value of what is actually a pointer to some structure or object belonging to the MySQL lib and that is not interpreted by MQL5, so you just store it as int for reference. However, the type int is 32-bits regardless of your architecture, and if you are using 64-bit system, the type int is not big enough to contain the value of a pointer. You have to use long instead.
Most libmysql.dll functions return pointers, such as mysql_init(), mysql_real_connect(), mysql_real_query(), etc, and most MQL5 scripts store the return value of those functions as int, an insufficient data type to represent those pointers, which is causing those problems.
I managed to get my scripts working perfectly in 64-bit environment by using long instead of int in some strategic places. Since all I really need is to insert stuff in the database, I only needed to change the functions I mentioned above.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello all:
Ive been using mysql for working with my EAs for some time now, I used mainly this EAX Library https://www.mql5.com/en/code/855, which I added a couple of functions and some error handlers for reconnections in case the connection gets dropped while executing a query, everything works perfectly except for one scenario when I load a lot of experts (9 at this point) on a single terminal all using this type of connection, when I restart my computer and load the terminal I would often get Access violation at 0x000000007788E4E4 write to 0x0000000000000024 and that expert will freeze there, If i close the terminal and open it back again without restarting the computer it will load without any problems, after a long research and debugging on my EAs Ive found out that this access violation will happen when the EA is trying to allocate the memory for the mysql object using the function mysql_init(), I was wondering if anyone can shed some light over here, if theres a way for me to ignore the exception and let the expert continue or if theres a workaround. Here is a little resumed code that will cause the error, am working on Windows 7 Ultimate x6, MySQL DataBase 5.1.73, libmysql 6.1.2.