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
15
votes
3 answers

Why don't Stack and Queue have Capacity property while List does?

Is Capacity property more useful in a List than in the other collections such as Stack and Queue? Or is there another way to get the capacity of a Stack or a Queue?
Setyo N
  • 1,953
  • 2
  • 26
  • 28
14
votes
2 answers

How to monitor python's concurrent.futures.ProcessPoolExecutor?

We are using the ProcessPoolExecutor from concurrent.futures in a service that asynchronously receives requests, and does the actual, synchronous processing in the process pool. Once we ran into the case that the process pool was exhausted, so new…
moritz
  • 12,710
  • 1
  • 41
  • 63
13
votes
3 answers

Difference between std::resize(n) and std::shrink_to_fit in C++?

I came across these statements: resize(n) – Resizes the container so that it contains ‘n’ elements. shrink_to_fit() – Reduces the capacity of the container to fit its size and destroys all elements beyond the capacity. Is there any significant…
13
votes
6 answers

Should a .NET generic dictionary be initialised with a capacity equal to the number of items it will contain?

If I have, say, 100 items that'll be stored in a dictionary, should I initialise it thus? var myDictionary = new Dictionary(100); My understanding is that the .NET dictionary internally resizes itself when it reaches a given loading,…
Drew Noakes
  • 300,895
  • 165
  • 679
  • 742
13
votes
7 answers

Uses for the capacity value of a string

In the C++ Standard Library, std::string has a public member function capacity() which returns the size of the internal allocated storage, a value greater than or equal to the number of characters in the string (according to here). What can this…
dreamlax
  • 93,976
  • 29
  • 161
  • 209
11
votes
6 answers

Advantages of creating an ArrayList with initial capacity of 0?

I am a somewhat experienced Java developer and I keep seeing things like this List l = new ArrayList(0); which I really can't understand. What's the point of creating an ArrayList with an initial capacity of 0, when you know it's…
Mauren
  • 1,955
  • 2
  • 18
  • 28
11
votes
4 answers

Can pop_back() ever reduce the capacity of a vector? (C++)

According to the C++ standard, is std::vector::pop_back() ever allowed to reduce the capacity of the vector? I am asking because I would like to have a guarantee, that the following code will not throw an out of memory…
Kristian Spangsege
  • 2,903
  • 1
  • 20
  • 43
10
votes
3 answers

Request-URI Too Large

Got this error on a big $_GET query in size ~9 000 symbols (they are divided into ~10 variables). Request-URI Too Large The requested URL's length exceeds the capacity limit for this server. What is a workaround for this problem?
Jasper
  • 5,090
  • 11
  • 34
  • 41
10
votes
3 answers

How many characters can a Java StringBuilder hold?

Does StringBuilder have a limit of characters for maximum capacity in JAVA. StringBuilder url=new StringBuilder(); stmt = connnection.createStatement(); String sql="SOME QUERY"; rs = stmt.executeQuery(sql); while(rs.next()) { String…
Narendra Rawat
  • 353
  • 2
  • 5
  • 17
9
votes
4 answers

Why is Deque (ArrayDeque) capacity a power of two?

In Java (but similarly in PHP) the ArrayDeque implementation always has its capacity as a power of 2: http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/687fd7c7986d/src/share/classes/java/util/ArrayDeque.java#l126 For HashMap this choice is clear - to…
radistao
  • 14,889
  • 11
  • 66
  • 92
8
votes
3 answers

C# List<> should I lower capacity as I remove items?

I have a List container which can potentially have up to 100,000 items in to start with. While the program is running this list will slowly empty, should I alter the capacity as I empty the list? I have done some testing and execution time seems to…
Eddie
  • 690
  • 10
  • 27
8
votes
2 answers

How to shrink-to-fit an std::vector in a memory-efficient way?

I would like to 'shrink-to-fit' an std::vector, to reduce its capacity to its exact size, so that additional memory is freed. The standard trick seems to be the one described here: template< typename T, class Allocator > void…
Frank
  • 64,140
  • 93
  • 237
  • 324
7
votes
0 answers

Why are arrays in .NET so much faster than lists?

Consider the following code: using System; using System.Collections.Generic; using System.Diagnostics; namespace ListAllocationPerformance { class Program { const int count = 100000000; public static object Memory { get;…
user2033412
  • 1,950
  • 2
  • 27
  • 47
7
votes
2 answers

What defines the capacity of a memory stream

I was calculating the size of object(a List that is being Populated), using the following code: long myObjectSize = 0; System.IO.MemoryStream memoryStreamObject = new System.IO.MemoryStream(); …
sujith karivelil
  • 28,671
  • 6
  • 55
  • 88
6
votes
1 answer

What is the meaning of AmazonDB Free Tier?

In my Android app I use Amazon DynamoDB. I created 10 tables with Read capacity 10 and Write capacity 5. Today I received an email from Amazon. It costs me 11.36$. I don't understand the meaning of free tier. Here is what I read from…
TOP
  • 2,574
  • 5
  • 35
  • 60
1
2
3
16 17