Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Parsing goes out of memory
Message
De
09/11/2013 10:31:43
 
 
À
09/11/2013 06:44:40
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01587600
Message ID:
01587625
Vues:
25
>As the others have said - you do not need a stringbuilder.
>
>
>You make the situation worse by using a string builder
>
>Explanation
>This creates one extra string on the heap
>
>
>return tcSearchIn.Replace(tcSearchFor, tcReplace);
>
>
>Next is worse
>
>StringBuilder sb = new StringBuilder(tcSearchIn);
>return sb.Replace(tcSearchFor, tcReplace).ToString();
>
>
>The stringbuilder, initialized with tcSearchIn, holds a char array presentation of the string
>This construct creates
>(1) a char array on the heap
>(2) a new string on the heap
>
>If the solution without the stringbuilder uses something like 100 Mb (temporarily), the solution with the stringbuilder uses 200 Mb.
>The extra 100 Mb is used for the char arrays

Initially, we had it like that. But, for very large memo fields which would need some replaces, using that would take too long. This is why we adapted the StrTran() method to use a StringBuilder().

Would you recommend I leave this StrTran() as is for the default and create StrTranFromString() for a specific location where I know the string to use will not be big?
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform