Questions tagged [capacity]

Questions about resource capacity. Use in conjunction with the applicable tag such as [memory], [disk] or [database] to indicate the type of resource being referred to.

Questions about resource capacity. Use in conjunction with the applicable tag such as , or to indicate the type of resource being referred to.

250 questions
6
votes
5 answers

C# - What is List initial capacity used for?

I'm trying to do the following: int count = 50; List myList = new List(50); output[0] = 0.0f; But I get the error: ArgumentOutOfRangeException: Argument is out of range. Parameter name: index Clearly I've misunderstood what the…
Vesuvian
  • 697
  • 1
  • 7
  • 22
6
votes
1 answer

How to gather disk usage on a storage system faster than just using "du"?

I operates a Synology NAS device and the unit includes that over 600 users data. The users backup data are tax accounting data. So, approximately one user's folder has 200,000 files. I have to provide their backup data usage informations to each…
Tommy
  • 81
  • 1
  • 1
  • 3
6
votes
1 answer

I/O Disk Drive Calculations

So I am studying for an up and coming exam, one of the questions involves calculating various disk drive properties. I have spent a fair while researching sample questions and formula but because I'm a bit unsure on what I have come up with I was…
user1356029
  • 381
  • 1
  • 5
  • 14
5
votes
2 answers

By how much does vector::resize increase capacity?

As far as I know the C++ standard does not specify exactly how vector capacity is increased when vector::resize requires an increase. But is there a "typical" implementation? Specifically: I don't know how large my vector needs to be. Further, the…
John H.
  • 1,551
  • 1
  • 12
  • 18
5
votes
3 answers

How does StringBuilder's capacity change?

When I have an empty StringBuilder with a capacity of 5 and I write "hello, world!" to it, does the C# standard specify the new capacity of the StringBuilder? I have a vague memory that it's twice the new string's length (to avoid changing the…
Vlad Vivdovitch
  • 9,295
  • 8
  • 22
  • 21
5
votes
8 answers

Declaring the capacity of a List in Java

I often use Lists in my Android applications. Right now I am creating a Twitter page which lists a maximum of 50 "tweets" of a user. I have a List defined like this: List tweets = new ArrayList(MAX_TWEETS); Where Tweet is a custom…
james
  • 26,141
  • 19
  • 95
  • 113
5
votes
3 answers

Is there a way to trim a Dictionary's capacity once it is known to be fixed size?

After reading the excellent accepted answer in this question: How is the c#/.net 3.5 dictionary implemented? I decided to set my initial capacity to a large guess and then trim it after I read in all values. How can I do this? That is, how can I…
philologon
  • 2,093
  • 4
  • 19
  • 35
5
votes
3 answers

Does Clearing an ArrayList preserve its Capacity

As the title mentions, if I create an ArrayList with initial capacity 500 and then clear it after some time will its capacity still be 500 ? or do I need to re-init it for that ?
Cemre Mengü
  • 18,062
  • 27
  • 111
  • 169
4
votes
2 answers

MAGIC number in Android google io 2011 java source

Below code grabbed from google io open source. com.google.android.apps.iosched.util.Lists.java http://code.google.com/p/iosched/source/browse/android/src/com/google/android/apps/iosched/util/Lists.java public static ArrayList
user1165390
  • 71
  • 1
  • 5
4
votes
1 answer

How do I show a warning when server is over capacity to avoid server goes down?

Twitter sometimes shows an message: Twitter is over capacity This is to prevent too much pressure on the servers. Which avoids that the servers go down. How do I implement this in my application? Edit: I am NOT looking for a PHP specific solution.
Wouter Dorgelo
  • 11,770
  • 11
  • 62
  • 80
4
votes
1 answer

How to increase event loop capacity in nodejs?

I know that Node.js uses a single-thread and an event loop to process requests only processing one at a time (which is non-blocking). But i am unable to determine Event loop capacity to run 100k request per second. Here i want to capacity planning…
Suresh Mahawar
  • 1,458
  • 15
  • 34
4
votes
3 answers

Is there any case when I should use ensureCapacity() on ArrayList externally?

The below code ensures a capacity of 11 internally, ArrayList list = new ArrayList(11); so why/when should I use public method ensureCapacity() externally? list.ensureCapacity(11); And if there is no use why it is kept public? public void…
Milind Vinkar
  • 159
  • 1
  • 9
4
votes
2 answers

when does a copy constructor get called in cpp?

#include #include #include #include #include using namespace std; class dog{ public: string name; dog(); dog(const dog & d); void barkname(){ cout<<"bark…
Casualet
  • 295
  • 3
  • 12
4
votes
1 answer

ArrayBlockingQueue exceeds given capacity

I've written program solving bounded producer & consumer problem. While constructing ArrayBlockingQueue I defined capacity 100. I'm using methods take and put inside threads. And I've noticed that sometimes I see put 102 times with any take's…
Wojciech Reszelewski
  • 2,656
  • 2
  • 18
  • 27
3
votes
1 answer

Why does StringBuilder have a default capacity of 16 characters?

Why does StringBuilder have a default capacity of 16 characters? Is this some kind of optimization? StringBuilder builder = new StringBuilder(); Console.WriteLine("builder capacity: '{0}'", builder.Capacity); output: builder capacity: '16'
Darius Kucinskas
  • 10,193
  • 12
  • 57
  • 79
1 2
3
16 17