[BLACKBOX] More memory management problems

From: [at]} <shristov>
Date: Tue, 28 Jun 2011 15:54:12 +0200

----boundary-LibPST-iamunique-177169279_-_-
Content-type: text/plain

The first problem is that a module with large global variables

becomes impossible to run after recompiling it due to insufficient memory.



The module doesn't allocate memory dynamically, and the actual

global variable size is far less than the available computer memory.



1. Copy and paste the module PrivLarge listed below.

   Save it.



2. Exit BlackBox and restart Windows.



3. Start BlackBox, open PrivLarge.odc and compile it.



4. Run the exported procedure "Do" ten times.

   If works fine.



5. Compile it again and unload.



6. Try to run "Do" again.

   There is no enough memory.



7. Just exit BlackBox and renter it.

   Procedure will run again until recompilg.



The second problem is that the global variable size cannot be increased beyond ~250 MB.

If the constant "n" is increased to, say, 90000000 (meaning 360 MB), the procedure "Do"

cannot run at all (even before recompiling).



This is done in BlackBox 1.5 on a PC with 3 GB RAM and Windows XP SP2.

The problem may be Windows related, but I doubt it.



>From my unrelieble memory I think that early BlackBox versions

didn't suffer from this problem. I'm not sure, however.





Regards,



Sinisa





--------------------------------------------------------------------





The module:





MODULE PrivLarge;



IMPORT Out;





CONST



  n = 60000000;





VAR



  a : ARRAY n OF INTEGER;





  PROCEDURE Do *;



  VAR



    i, sum : INTEGER;



  BEGIN



    FOR i:=0 TO n-1 DO

      a[i] := i

    END;



    sum := 0;

    FOR i:=0 TO n-1 DO

      sum := sum + a[i]

    END;



    Out.Ln;

    Out.String ("sum = ");

    Out.Int (sum, 12);

    Out.Ln;

    Out.Ln



  END Run;





END PrivLarge.





--------------------------------------------------------------------





The Log output:



compiling "PrivLarge" 156 240000000

PrivLarge not found



sum = 651082880





sum = 651082880





sum = 651082880





sum = 651082880





sum = 651082880





sum = 651082880





sum = 651082880





sum = 651082880





sum = 651082880





sum = 651082880



compiling "PrivLarge" 156 240000000

PrivLarge unloaded

command error: not enough memory for PrivLarge





--------------------------------------------------------------------


----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy----boundary-LibPST-iamunique-177169279_-_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ClxwYXINClxwYXINClxwYXINCiAgQkVHSU5ccGFyDQpccGFyDQpc
cGFyDQpccGFyDQogICAgRk9SIGk6PTAgVE8gbi0xIERPXHBhcg0KXHBhcg0KICAgICAgYVtpXSA6
PSBpXHBhcg0KXHBhcg0KICAgIEVORDtccGFyDQpccGFyDQpccGFyDQpccGFyDQogICAgc3VtIDo9
IDA7XHBhcg0KXHBhcg0KICAgIEZPUiBpOj0wIFRPIG4tMSBET1xwYXINClxwYXINCiAgICAgIHN1
bSA6PSBzdW0gKyBhW2ldXHBhcg0KXHBhcg0KICAgIEVORDtccGFyDQpccGFyDQpccGFyDQpccGFy
DQogICAgT3V0LkxuO1xwYXINClxwYXINCiAgICBPdXQuU3RyaW5nICgic3VtID0gIik7XHBhcg0K
XHBhcg0KICAgIE91dC5JbnQgKHN1bSwgMTIpO1xwYXINClxwYXINCiAgICBPdXQuTG47XHBhcg0K
XHBhcg0KICAgIE91dC5MbiAgICBccGFyDQpccGFyDQpccGFyDQpccGFyDQogIEVORCBSdW47XHBh
cg0KXHBhcg0KXHBhcg0KXHBhcg0KXHBhcg0KXHBhcg0KRU5EIFByaXZMYXJnZS5ccGFyDQpccGFy
DQpccGFyDQpccGFyDQpccGFyDQpccGFyDQotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t
LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLVxwYXINClxwYXINClxwYXINClxw
YXINClxwYXINClxwYXINClRoZSBMb2cgb3V0cHV0OlxwYXINClxwYXINClxwYXINClxwYXINCmNv
bXBpbGluZyAiUHJpdkxhcmdlIiAgIDE1NiAgIDI0MDAwMDAwMFxwYXINClxwYXINClByaXZMYXJn
ZSBub3QgZm91bmRccGFyDQpccGFyDQpccGFyDQpccGFyDQpzdW0gPSAgICA2NTEwODI4ODBccGFy
DQpccGFyDQpccGFyDQpccGFyDQpccGFyDQpccGFyDQpzdW0gPSAgICA2NTEwODI4ODBccGFyDQpc
cGFyDQpccGFyDQpccGFyDQpccGFyDQpccGFyDQpzdW0gPSAgICA2NTEwODI4ODBccGFyDQpccGFy
DQpccGFyDQpccGFyDQpccGFyDQpccGFyDQpzdW0gPSAgICA2NTEwODI4ODBccGFyDQpccGFyDQpc
cGFyDQpccGFyDQpccGFyDQpccGFyDQpzdW0gPSAgICA2NTEwODI4ODBccGFyDQpccGFyDQpccGFy
DQpccGFyDQpccGFyDQpccGFyDQpzdW0gPSAgICA2NTEwODI4ODBccGFyDQpccGFyDQpccGFyDQpc
cGFyDQpccGFyDQpccGFyDQpzdW0gPSAgICA2NTEwODI4ODBccGFyDQpccGFyDQpccGFyDQpccGFy
DQpccGFyDQpccGFyDQpzdW0gPSAgICA2NTEwODI4ODBccGFyDQpccGFyDQpccGFyDQpccGFyDQpc
cGFyDQpccGFyDQpzdW0gPSAgICA2NTEwODI4ODBccGFyDQpccGFyDQpccGFyDQpccGFyDQpccGFy
DQpccGFyDQpzdW0gPSAgICA2NTEwODI4ODBccGFyDQpccGFyDQpccGFyDQpccGFyDQpjb21waWxp
bmcgIlByaXZMYXJnZSIgICAxNTYgICAyNDAwMDAwMDBccGFyDQpccGFyDQpQcml2TGFyZ2UgdW5s
b2FkZWRccGFyDQpccGFyDQpjb21tYW5kIGVycm9yOiBub3QgZW5vdWdoIG1lbW9yeSBmb3IgUHJp
dkxhcmdlXHBhcg0KXHBhcg0KXHBhcg0KXHBhcg0KXHBhcg0KXHBhcg0KLS0tLS0tLS0tLS0tLS0t
LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS1ccGFy
DQpccGFyDQpccGFyDQotLS0tXHBhcg0KVG8gdW5zdWJzY3JpYmUsIHNlbmQgYSBtZXNzYWdlIHdp
dGggYm9keSAiU0lHTk9GRiBCTEFDS0JPWCIgdG8gTElTVFNFUlZATElTVFMuT0JFUk9OLkNIfX0A
NyPHIg==
----boundary-LibPST-iamunique-177169279_-_---
Received on Tue Jun 28 2011 - 15:54:12 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:30:13 UTC