[ncl-talk] buffer overflow detected
Dave Allured - NOAA Affiliate
dave.allured at noaa.gov
Fri Sep 24 13:02:08 MDT 2021
Please note that I suggested asciiwrite, not write_table. Asciiwrite is
different internal code that may very well not be limited to an
8192-character line length. I did not check the internal code.
On Fri, Sep 24, 2021 at 12:55 PM Rick Brownrigg via ncl-talk <
ncl-talk at mailman.ucar.edu> wrote:
> Hi Micah,
>
> It looks like the text of the error message actually comes from the
> standard C library. I can't relate that directly to the NCL code, but
> looking at the code underlying write_table(), I can see that there's a
> character buffer of len 8192 that gets allocated to hold a line's worth of
> output in the table. The code builds up a line by stepping through each
> element in the list passed to write_table, formatting the element and
> appending the text to the character buffer. I don't see where there's ever
> a point at which the buffer is reallocated should it become full.
>
> Is it possible your table lines are > 8192 characters? Not that this
> information does you much good -- at least you know the potential limit,
> and can use Dave's advice to work within that bound.
>
> Rick
>
> On Fri, Sep 24, 2021 at 12:01 PM Micah Sklut <micahs2005 at gmail.com> wrote:
>
>> Hi Rick,
>>
>> Yes, it is a copy/paste of the error.
>>
>> On Fri, Sep 24, 2021 at 12:18 PM Rick Brownrigg <brownrig at ucar.edu>
>> wrote:
>>
>>> Hi,
>>>
>>> I can't find anywhere in the source code where such an error message
>>> would arise. Is that a literal copy/paste of the error?
>>>
>>> Rick
>>>
>>>
>>> On Fri, Sep 24, 2021 at 10:03 AM Micah Sklut via ncl-talk <
>>> ncl-talk at mailman.ucar.edu> wrote:
>>>
>>>> Hi NCL Talk,
>>>>
>>>> I'm using write_table to output a large amount of data to file.
>>>> Here's the output statement:
>>>>
>>>> alist =
>>>> [/latPoints,lonPoints,hsString,perString,dirString,winduString,windvString,phs1String,phs2String,phs3String,phs4String,phs5String,phswindString,pdir1String,pdir2String,pdir3String,pdir4String,pdir5String,pdirwindString,ptp1String,ptp2String,ptp3String,ptp4String,ptp5String,ptpwindString/]
>>>>
>>>>
>>>> write_table("outf_data.txt","w",alist,"%6.3f,%6.3f,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s");
>>>>
>>>> I'm getting the following message:
>>>>
>>>> *** buffer overflow detected ***: ncl terminated
>>>> Aborted
>>>>
>>>> When I reduce the string lengths of the variables, then I don't get
>>>> this error, so I"m guessing I"m running into an NCL string length maximum?
>>>>
>>>> Any suggestions on how to get around this problem?
>>>>
>>>> Thank you.
>>>>
>>>> --
>>>> Micah Sklut
>>>>
>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210924/dd99aeb5/attachment.html>
More information about the ncl-talk
mailing list