Home AMX User Forum NetLinx Studio

Buffer size

What is the maximum buffer size in NetLinx?

Comments

  • Can't put my finger an an exact max value but I have code reading in large files where I implemented 100k strings

    stack_var char iBuffer[100000]; // You really  DON'T  want  to use a non-volatile local_var here ;-)
    
  • viningvining Posts: 4,368
    edited November 2018

    The largest I have working is a local var cTmpBuf[262140]. Local so it can concatenate incoming strings through multiple data events. Just like with some large structures I can't view in debug because it will crash NS4.

    STRING:
          {
              LOCAL_VAR CHAR cTmpBuf[262140];
    
              fnConcatString(cTmpBuf,DATA.TEXT)
    
    ............
    
  • if you're going to use a local_var for a big buffer like that allocate it out of volatile...

       local_var volatile char cTmpBuf[262140]; // Yes, you can do this
    

    Believe me, trying to track down why the processor crashed because it ran out of non volatile memory can be a time consuming exercise.

  • viningvining Posts: 4,368

    Hmmm, I don’t think I’ve ever designated a local var as volatile. Maybe I always assumed they were that way naturally whereas globals were only assignable and non volatile by default. I can’t think of anywhere at least in my code where a local needs to be non volatile but I guess since I’ve never designated them volatile they are. .

  • HARMAN_icraigieHARMAN_icraigie Posts: 660
    edited November 2018

    stack_var is allocated out of volatile.
    local_var is allocated out of non-volatile by default.

    I can personally testify that if you have a common file reading function that allocates 100k local_var buffers and that file is referenced by a dozen or so modules and that when all those modules call that read function simultaneously the master will immediately reboot...

Sign In or Register to comment.