View Issue Details

IDProjectCategoryView StatusLast Update
0007565Multi Theft Auto : San AndreasServerpublic2018-09-05 22:29
ReporterarranTuna Assigned To 
Status closedResolutionsuspended 
Summary0007565: callRemote memory leaks

If a server uses callRemote a lot, it seems that the memory it uses doesn't get freed up after waiting a long time.

Steps To Reproduce
  1. Add <min_mta_version server="1.3.1"></min_mta_version> to your runcode meta.xml
  2. Start local server
  3. Start runcode
  4. Open task manager and check current usage of MTA server.exe
  5. Paste "run for i=1, 100000 do callRemote("a", 1, function() end) end" into server console and hit enter
  6. Observe memory usage goes up to about 350mb where it then stays and doesn't go back down
TagsNo tags attached.

  Users sponsoring this issue
Sponsors List Total Sponsorship = EUR 110

2014-07-09 14:49: Exciter (EUR 10)
2018-03-27 01:50: castillo14 (EUR 100)
  Users sponsoring this issue (Total Sponsorship = EUR 110)


child of 0008477 new New Feature Requests [Request] callRemote/fetchRemote suggestions 



2014-06-27 12:49

manager   ~~0021146

Re-tested in MTA:SA Server v1.4-release-6606 and still present. I've waited 10 minutes and the memory usage hasn't gone down.


2014-08-19 22:58

viewer   ~~0021811

Today I had time to test your code and I analyzed the problem.
So I degbugged the callRemote procedure and the I got the following result:
If you call the callRemote function every time there will be created a CRemoteCall object in the C++ source code. Every of this objects are getting in a queue from downloading manager. Now when you create 100000 of the objects and the queue need to work off all this objects. After a work off of one object the object will be deleted and the memory will be free. But here you see the speed of the work off:

So the code works well, but the demonstrated code example is very inefficient.


2014-08-20 00:54

manager   ~~0021813

I've left it running for a an hour after though and the memory usage never goes down and the same should happen with less than 100,000 it's just that 100,000 shows how much memory could increase by.


2014-08-20 10:23

viewer   ~~0021817

Last edited: 2014-08-20 10:25

In the afternoon I will test this with a valid test result.
The problem is, every RemoteCall will take about 3 seconds.
100000 * 3 seconds = 300000 seconds
300000 seconds / 60 seconds per minute = 5000 minutes
5000 minutes / 60 minutes per hour = 83.3 hours
83.3 hours / 24 hours per day = 3.47 days

The result to workoff are 3.47 days, then the memory will largely be free. :D
Another problem is, that the result length is not always the same (~ 3 seconds).


2016-06-23 01:28

updater   ~~0024838



2018-03-26 23:47

viewer   ~~0026483

fetchRemote seems to be also affected by this, a resource using fetchRemote often will freeze the server if you restart it after a while (a day or so).


2018-09-05 22:29

administrator   ~~0026968

Moved to

Issue History

Date Modified Username Field Change