Click here to Skip to main content
15,881,715 members
Home / Discussions / C#
   

C#

 
QuestionRe: alphanumeric counter Pin
Matt T Heffron14-Feb-13 9:52
professionalMatt T Heffron14-Feb-13 9:52 
AnswerRe: alphanumeric counter Pin
Angela Scheuvront14-Feb-13 10:15
Angela Scheuvront14-Feb-13 10:15 
GeneralRe: alphanumeric counter Pin
Matt T Heffron14-Feb-13 10:25
professionalMatt T Heffron14-Feb-13 10:25 
GeneralRe: alphanumeric counter Pin
Angela Scheuvront15-Feb-13 1:45
Angela Scheuvront15-Feb-13 1:45 
AnswerRe: alphanumeric counter Pin
Richard Deeming15-Feb-13 1:37
mveRichard Deeming15-Feb-13 1:37 
GeneralRe: alphanumeric counter Pin
Matt T Heffron15-Feb-13 7:39
professionalMatt T Heffron15-Feb-13 7:39 
QuestionStreamWriter.WriteAsync Pin
wizardzz14-Feb-13 6:15
wizardzz14-Feb-13 6:15 
AnswerRe: StreamWriter.WriteAsync Pin
Dave Kreskowiak14-Feb-13 7:31
mveDave Kreskowiak14-Feb-13 7:31 
How big is that freaking StringBuilder?? If you don't specify a size, it starts with 16 characters and allocates a new array internally every time you exceed it's capacity. So, it starts with 16, then goes to 32, 64, 128, 512, 1024, ... when you get into VERY large objects, you can be allocating megabytes of memory and possibly hit a size where the CLR doesn't have a big enough contiguous block of memory to fit the new size.

This also applies when you finally call .ToString on the StringBuilder. A new String object has to be allocated and the data in the StringBuilder copied to it. Again, if sufficiently big, the new String may not fit in memory because of a fragmented large object heap.

The CLR will allocate any object requiring more than 85K (IIRC) out of the LOB. The LOB isn't compacted and defragmented like the Smaller Object Heap is. So if you're allocating and freeing a bunch of large objects, you could be fragmenting the LOB to the point where you can't allocate a new object of the size you need, even though there's enough TOTAL free memory.

But, the way around this little problem using StringBuilder is to allocate the StringBuilder with a size sufficient to hold the entire POSSIBLE string without having it constantly reallocate itself.


Oh! And as for the StreamWriter.WriteAsync, there is no equivilent in any other version of .NET. You'd have to implement an Async version yourself. But, I don't think that has anything to do with your problem right now.

GeneralRe: StreamWriter.WriteAsync Pin
wizardzz14-Feb-13 8:33
wizardzz14-Feb-13 8:33 
GeneralRe: StreamWriter.WriteAsync Pin
wizardzz14-Feb-13 8:55
wizardzz14-Feb-13 8:55 
Questionsingle selection of radio buttons in a table Pin
Member 258173814-Feb-13 4:36
Member 258173814-Feb-13 4:36 
AnswerRe: single selection of radio buttons in a table Pin
Richard MacCutchan14-Feb-13 4:58
mveRichard MacCutchan14-Feb-13 4:58 
AnswerRe: single selection of radio buttons in a table Pin
Alan Balkany14-Feb-13 5:04
Alan Balkany14-Feb-13 5:04 
QuestionBetter code Pin
ali_heidari_14-Feb-13 3:57
ali_heidari_14-Feb-13 3:57 
AnswerRe: Better code Pin
Alan Balkany14-Feb-13 4:50
Alan Balkany14-Feb-13 4:50 
GeneralRe: Better code Pin
Manfred Rudolf Bihy14-Feb-13 5:28
professionalManfred Rudolf Bihy14-Feb-13 5:28 
QuestionRe: Better code Pin
ali_heidari_14-Feb-13 5:40
ali_heidari_14-Feb-13 5:40 
AnswerRe: Better code Pin
Alan Balkany14-Feb-13 5:50
Alan Balkany14-Feb-13 5:50 
GeneralRe: Better code Pin
Dave Kreskowiak14-Feb-13 6:09
mveDave Kreskowiak14-Feb-13 6:09 
GeneralRe: Better code Pin
Espen Harlinn14-Feb-13 6:14
professionalEspen Harlinn14-Feb-13 6:14 
GeneralRe: Better code Pin
Alan Balkany14-Feb-13 6:40
Alan Balkany14-Feb-13 6:40 
GeneralRe: Better code Pin
ali_heidari_14-Feb-13 12:02
ali_heidari_14-Feb-13 12:02 
GeneralRe: Better code Pin
Alan Balkany15-Feb-13 3:18
Alan Balkany15-Feb-13 3:18 
AnswerRe: Better code Pin
sonusonyy14-Feb-13 8:19
sonusonyy14-Feb-13 8:19 
GeneralRe: Better code Pin
Amir Mohammad Nasrollahi29-Jul-13 22:16
professionalAmir Mohammad Nasrollahi29-Jul-13 22:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.