Author Topic: Memory usage to big  (Read 386 times)

0 Members and 1 Guest are viewing this topic.

Aurel

  • Sr. Member
  • ****
  • Posts: 261
Memory usage to big
« on: April 19, 2018, 11:46:48 AM »
Hi Charles

I hope that is not bug or you already fixed that..
so let me know
I always keep Task manager open then i see that my small test program use 17.000k
wow
then i tryed with old release 041 and same program work with 3.124k
I must say that program work fine with o2progress(043) but use to much memory.
do I have right?
I dont know what might be else?
garbage collector not work or something?

Aurel

Charles Pegge

  • Admin Support Member
  • *****
  • Posts: 3745
    • Oxygen Basic
Re: Memory usage to big
« Reply #1 on: April 19, 2018, 12:49:37 PM »
Can you give us a few more clues please, Aurel ?

Aurel

  • Sr. Member
  • ****
  • Posts: 261
Re: Memory usage to big
« Reply #2 on: April 19, 2018, 01:11:38 PM »
OK
Look this small program with strings
how is possible that have such big mem footprint?

Code: [Select]
'Parser -Eval -o2- by Aurel 2018
$ filename "ParseEval.exe"
#lookahead
string token,crlf= chr(13)+chr(10),buff
'test expression -> 2+3*4
string TokenList[] = {"2","+","3","*","4"}
string OperatorList[] = {"-","+","*","/","^","("} '6
string op
'get size of list?
print spanof(TokenList) ' size of array -> 5 ...count of tokens
int tokCount = spanOf(TokenList)
int prec
string opStack
string opPLUS,opMULTI
string cell
'
'loop trough tokens
For t = 1 to tokCount
token = TokenList[t]
     If instr("+-*/^(",token) <> 0
     op = token
 print "OP:"  + op
     End if
 
if token <> op
buff = buff + tokenlist[t]
end if   
     'select token
'case "("
'.........................
'case "^"
'.........................
'case "/"
         '..........................
if token = "*"
buff = buff + tokenlist[t] + crlf
end if

'.........................
if token = "+"
            buff = buff + tokenlist[t]  + crlf
         end if
'.........................

     'end select



    'buff = buff + token

    'print "BUFF: " buff + "  N:" + str(t)
     
     ' i instr(token,"+-*/^(",op) = 0
          'buff = buff + token + crlf
      'end if

Next t
'show operator buffer
print buff

Aurel

  • Sr. Member
  • ****
  • Posts: 261
Re: Memory usage to big
« Reply #3 on: April 19, 2018, 01:16:40 PM »
Or this one even smaller:

Code: [Select]
'autodefined pointers works
string a = "Oxygen"
@p = a
print p  ' show Oxygen

char c[] = "Basic"
p = strptr c

print p ' show Basic

'defined not
sys p2
string a = "Oxygen2"
@p2 = a
print p2  ' show Oxygen

sys pc
char c[] = "Basic2"
pc = strptr c

print pc

Aurel

  • Sr. Member
  • ****
  • Posts: 261
Re: Memory usage to big
« Reply #4 on: April 19, 2018, 01:21:13 PM »
..or this one

Code: [Select]
'test memory
string s = "Oxgen"
string b = "basic"
string c = s+b
print c

use 14.722k on my win732bit comp ?
Charles ..do you can confirm that?
or something is wrong with my pc ::)
or i have wrong oxygen dll

Aurel

  • Sr. Member
  • ****
  • Posts: 261
Re: Memory usage to big
« Reply #5 on: April 19, 2018, 01:55:04 PM »
Charles
Maybe this is not important but i found that new oxygen.dll is compressed with UPX
do i have a right?
If is do you can attach uncompressed version?

Charles Pegge

  • Admin Support Member
  • *****
  • Posts: 3745
    • Oxygen Basic
Re: Memory usage to big
« Reply #6 on: April 19, 2018, 01:59:35 PM »
Yes, I can confirm that more recent versions of Oxygen, have a larger fixed buffer space, accommodating up to 200,000 symbols. This not a problem for our Gigabyte PCs, but a more dynamic allocation of space would be beneficial.

The space required for an independent binary seems to start at about 1.6 Meg, (print "helo") but this is not determined by the compiler.

Aurel

  • Sr. Member
  • ****
  • Posts: 261
Re: Memory usage to big
« Reply #7 on: April 19, 2018, 02:10:50 PM »
Hmm ..ok
but why is compressed?

Arnold

  • Hero Member
  • *****
  • Posts: 660
Re: Memory usage to big
« Reply #8 on: April 19, 2018, 03:24:48 PM »
Hi Aurel,

if you download UPX you can unzip oxygen.dll yourself. But it does not matter, because the used workspace will be the same. When using the newer oxygen.dll for JIT modus then the used memory space will be larger, but this is really no problem. If you use the task manager then check for the used memory of other applications, like Ruby or Python. My AV-Scanner alone uses 110.000 kb for scanning a little exe file.
I compiled your examples as independent exes. There is not much difference with the used memory space, the results are about 860-870 kb.

Last but least I am surprised that you still use a version A41 of 2015. The difference is that the Beta release can still run and compile your examples, but A41 will not be able to do many things which are possible now with the B0 version. And it will also not work if you try to mix an old oxygen.dll with the new include files. This would only cause confusion.

Roland

John

  • Hero Member
  • *****
  • Posts: 3249
Re: Memory usage to big
« Reply #9 on: April 19, 2018, 05:32:49 PM »
If you're using oxygen.dll the runtime is shared among like processes with only memory allocation for each processes data needs.

Aurel

  • Sr. Member
  • ****
  • Posts: 261
Re: Memory usage to big
« Reply #10 on: April 20, 2018, 02:33:41 AM »
Hi Arnold
Yes you have right and i don't know how i miss this :

so if is compiled :

$ Filename "MyProgram.exe"
include "RTL32.inc"

then memory use 712k which is great  :)

so JIT.ed mode use 14k

Still ,i dont like UPX-ed oxygen.dll

PS . I use old 041 just to see how things work.

Charles Pegge

  • Admin Support Member
  • *****
  • Posts: 3745
    • Oxygen Basic
Re: Memory usage to big
« Reply #11 on: April 20, 2018, 02:42:25 AM »
A compact oxygen.dll is handy when it is deployed within another system, like thinBasic. That is where I got the idea from. Eros UPXes all the thinBasic DLLs.