Skip to content

Commit e8df89e

Browse files
committed
review feedback
1 parent 68c4322 commit e8df89e

File tree

1 file changed

+3
-3
lines changed
  • src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient

1 file changed

+3
-3
lines changed

src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13093,9 +13093,9 @@ bool writeDataSizeToSnapshot
1309313093
);
1309413094
charsLeft = len;
1309513095

13096-
// If total length is known up front, the length isn't specified as unknown
13097-
// and the caller doesn't pass int.max/2 indicating that it doesn't know the length
13098-
// allocate the whole buffer in one shot instead of realloc'ing and copying over each time
13096+
// If total data length is known up front from the plp header by being not SQL_PLP_UNKNOWNLEN
13097+
// and the number of chars required is less than int.max/2 allocate the entire buffer now to avoid
13098+
// later needing to repeatedly allocate new target buffers and copy data as we discover new data
1309913099
if (buff == null && stateObj._longlen != TdsEnums.SQL_PLP_UNKNOWNLEN && stateObj._longlen < (int.MaxValue >> 1))
1310013100
{
1310113101
if (supportRentedBuff && stateObj._longlen < 1073741824) // 1 Gib

0 commit comments

Comments
 (0)