none
How to design a buffer at .net environment RRS feed

  • Question

  • Hi,

    I use the .Net 4.0 to programming. We need to process a large data at realtime. So we plan to use the big buffer to improve the performance. Is there some special thing we need to care for the GC.

    I am sorry this question is somehow a little at high level.  please give me some advice or passages. Thanks


    FM

    Monday, November 26, 2012 12:25 PM

Answers

  • There's really not enough information to provide any meaingful advice. By "big buffer" I would assume you mean more than 85kbytes so you should read about the Large Object Heap:

    http://msdn.microsoft.com/en-us/magazine/cc534993.aspx

    @Joel Engineer:

    "A large buffer should use a memorystream class and in the constructor don't include a size"

    Using a memory stream for large data of unknown size is actually a bad idea.

    "expandable byte[]"

    There's no such thing, arrays are not expandable.

    "which is only limitied by the amount of memory in your PC"

    A byte[] is limited to 2GB no matter how much memory your PC has.

    "If you specify the number of bytees then you get a non expandable byte[]."

    You cannot create a byte[] without specifying its length.

    Seriously...

    Monday, November 26, 2012 1:10 PM
    Moderator

All replies

  • A large buffer should use a memorystream class and in the constructor don't include a size.  An expandable byte[] array will be created which is only limitied by the amount of memory in your PC.  If you specify the number of bytees then you get a non expandable byte[].

    jdweng

    Monday, November 26, 2012 12:43 PM
  • There's really not enough information to provide any meaingful advice. By "big buffer" I would assume you mean more than 85kbytes so you should read about the Large Object Heap:

    http://msdn.microsoft.com/en-us/magazine/cc534993.aspx

    @Joel Engineer:

    "A large buffer should use a memorystream class and in the constructor don't include a size"

    Using a memory stream for large data of unknown size is actually a bad idea.

    "expandable byte[]"

    There's no such thing, arrays are not expandable.

    "which is only limitied by the amount of memory in your PC"

    A byte[] is limited to 2GB no matter how much memory your PC has.

    "If you specify the number of bytees then you get a non expandable byte[]."

    You cannot create a byte[] without specifying its length.

    Seriously...

    Monday, November 26, 2012 1:10 PM
    Moderator