Community discussions

MikroTik App
 
andredossantos
just joined
Topic Author
Posts: 8
Joined: Thu Jul 21, 2016 9:21 pm

Variables and the 4096 bytes limit

Mon May 22, 2017 4:21 pm

The manual for scripting, under Variables (https://wiki.mikrotik.com/wiki/Manual:S ... #Variables), says the following:
Note: Variable value size is limited to 4096bytes
Does that apply somehow to arrays?

> :global v [/interface print as-value]
> :global s [:tostr $v]
138
> :put [:len $s]
11767

The above three commands were run on RouterOS version 6.36.4.
They show variable $s with more bytes than the documentation says is the limit.

Did I misunderstand the manual?

I tried to add this to the Wiki Discussion page, but I don't have permission to edit.

User janisk, in the message at viewtopic.php?f=9&t=40830&p=202842#p203413, says that there was never any limit on variable size, but only on files:
always variables could hold more data than 4KB. Only limitation is how much you can write/read to file.
User rextended has this warning in the message at viewtopic.php?f=9&t=82972&p=415090&hilit=4096#p415090:
On RouterOS the maxmimum length of a String variable are 4096 Byte
...
any Array have maximum size of "the sum of lenght of all single elements on Array" + "number of Array elements" <= 4096 Byte!!!
Could someone please clarify?

I'm currently using a global variable that's larger than 4096 bytes, and I want to make sure that future versions of RouterOS are not going to break that.
 
PackElend
Member Candidate
Member Candidate
Posts: 272
Joined: Tue Sep 29, 2020 6:05 pm

Re: Variables and the 4096 bytes limit

Wed Dec 27, 2023 10:57 pm

Hi,
have you ever got your answer (by yourself) ?
Are you aware of viewtopic.php?t=197190 and viewtopic.php?p=1012747#p1012747 ?
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 12014
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Variables and the 4096 bytes limit

Thu Dec 28, 2023 11:04 am

Hi,
have you ever got your answer (by yourself) ?
Are you aware of viewtopic.php?t=197190 and viewtopic.php?p=1012747#p1012747 ?
2017-05-22

do not necroposting

Who is online

Users browsing this forum: No registered users and 8 guests