dynamic vs. static

Its been a while since I posted...but nvmd that.

Quite simply, I have a buffer that needs to hold some stuff. Its max size can be determined before runtime (its 1024 actually, 1KB), so I can make it static...however, I'm sure by a lot that only a few expections would use even close to that...

Throughout this entire set of functions, yes, I've been using a lot of dynamically allocated buffers, so I'd like to lax on the use, bu I'm risking a serious waste of memory here.

Which is better, to just nevermind the waste for the sacrifice of speed( ie. using a static 1024 byte buffer), or dynamically allocationg it beforehand?

thanx
{2}rIng

Comments

  • : Its been a while since I posted...but nvmd that.
    :
    : Quite simply, I have a buffer that needs to hold some stuff. Its max size can be determined before runtime (its 1024 actually, 1KB), so I can make it static...however, I'm sure by a lot that only a few expections would use even close to that...
    :
    : Throughout this entire set of functions, yes, I've been using a lot of dynamically allocated buffers, so I'd like to lax on the use, bu I'm risking a serious waste of memory here.
    :
    : Which is better, to just nevermind the waste for the sacrifice of speed( ie. using a static 1024 byte buffer), or dynamically allocationg it beforehand?
    :
    : thanx
    : {2}rIng
    :

    In this case 1024 bytes is next to nothing. In the days of MS-DOS and limited resources you would probably need to be more consertive, but those days are happily long gone for all but a few rare operating systems, such as embedded programs. Just statically allocate the buffer and ignore the wasted space.

  • : : Its been a while since I posted...but nvmd that.
    : :
    : : Quite simply, I have a buffer that needs to hold some stuff. Its max size can be determined before runtime (its 1024 actually, 1KB), so I can make it static...however, I'm sure by a lot that only a few expections would use even close to that...
    : :
    : : Throughout this entire set of functions, yes, I've been using a lot of dynamically allocated buffers, so I'd like to lax on the use, bu I'm risking a serious waste of memory here.
    : :
    : : Which is better, to just nevermind the waste for the sacrifice of speed( ie. using a static 1024 byte buffer), or dynamically allocationg it beforehand?
    : :
    : : thanx
    : : {2}rIng
    : :
    :
    : In this case 1024 bytes is next to nothing. In the days of MS-DOS and limited resources you would probably need to be more consertive, but those days are happily long gone for all but a few rare operating systems, such as embedded programs. Just statically allocate the buffer and ignore the wasted space.
    :
    :

    Thank goodness! He he...finally, one thing I won't have to do dynamic allocs for...
    {2}rIng
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories