memory() can be negative

Posted By: GPEngine

memory() can be negative - 10/19/14 23:50

memory() can return a negative number.
Posted By: jcl

Re: memory() can be negative - 10/22/14 17:37

Theoretically yes, when less memory is used than at the begin of the simulation - but that must be a special situation. Can you give an example?
Posted By: GPEngine

Re: memory() can be negative - 10/25/14 15:16

Under wine, Zorro's memory() function gives absurd values in the range (-2GB, 2GB) apparently at random.
Quote:
Memory 210016 kb
Memory 1255794 kb
Memory -1814190 kb
Memory 953517 kb
Memory 1613223 kb
Memory -1284531 kb
Memory -799298 kb
Memory -688318 kb
Memory -1430684 kb
Memory 1377544 kb
Memory 2069407 kb
Generate Chart - please wait... ok
Posted By: jcl

Re: memory() can be negative - 10/27/14 11:18

Ah, this could explain it. memory() uses a Windows function, GetProcessMemoryInfo(). This function is rarely used in applications and I can imagine that it is not properly supported by Wine. Can you test the same script on a real Windows system?
Posted By: GPEngine

Re: memory() can be negative - 10/27/14 15:10

This script
Code:
function run() {
  set(MUTE);
  set(PLOTNOW);
  StartDate = 20140301;
  EndDate = 20140901;
  BarPeriod = 60;

  var atrx = ATR(200);

  printf("\nMemory %i kb", memory()/1024);
}

gives the wild numbers above when run by Zorro under wine.
The same script reports consistent numbers (43MB I think) when run by Zorro within a Windows 7 VirtualBox instance.

Oddly, removing the ATR() line makes memory() result consistent under wine.

There are some discussions/bugs at winehq.org related to GetProcessMemoryInfo, which I can see now that I know what to search for. Thanks.
© 2024 lite-C Forums