Stack<T>, object memory usage query.

  • Thread starter Thread starter Jesper, Denmark
  • Start date Start date
J

Jesper, Denmark

Hi,

I'm using a stack<T>.
Is there a way to set an upper limit for the number of elements in the stack
such that a push operation can 'push' the first element out of the root of
the LIFO collection.

Is there a way to messure the memory allocated/used by an object and all the
objects that it holds refereces to.

thanks
Jesper
 
Jesper said:
Hi,

I'm using a stack<T>.
Is there a way to set an upper limit for the number of elements in the stack
such that a push operation can 'push' the first element out of the root of
the LIFO collection.

Is there a way to messure the memory allocated/used by an object and all the
objects that it holds refereces to.

thanks
Jesper

Well, you can serialize it to a binary file. It won't give you a 100%
accurate measure of how much memory is used, but it will give you some
indication.

What exactly is the problem you're trying to solve?
 
Hi,

I'm using a stack<T>.
Is there a way to set an upper limit for the number of elements in
the stack such that a push operation can 'push' the first element out
of the root of the LIFO collection.

It sounds like you want a "ring buffer". There are a number of
implementations around, none included with .NET, but now you know what to
google for...
 
Back
Top