Questions tagged [pool]

A pool describes a cache of resources that an application can draw from to save instantiation time.

Pools typically refer to database connections but the term can be applied to graphics handles, files and other run-time processes. When the use of such a resource is complete but the application is still running, it will typically return the resource to the pool rather than release it.

1504 questions
5
votes
3 answers

Avoid creating 'new' String objects when converting a byte[] to String using a specific charset

I'm reading from a binary file and want to convert the bytes to US ASCII strings. Is there any way to do this without calling new on String to avoid multiple semantically equal String objects being created in the string literal pool? I'm thinking…
vahidg
  • 3,953
  • 2
  • 22
  • 30
5
votes
3 answers

Memory Pool in C++

I have very high performance C++ library. I am thinking of writing a memory pool so that I do not have to use global new and delete. I did some reading. But wanted to know will this help me in performance and memory leaks reduction.
Avinash
  • 12,851
  • 32
  • 116
  • 186
5
votes
1 answer

Any clonable object pool implementation in C or C++?

This may seem odd, but I'll try to rationalize it. I currently use boost.object_pool extensively in conjunction with shared_ptr, and recently I encountered a situation that I need to take snapshots of current program states, in order to make…
arch.jslin
  • 81
  • 4
5
votes
2 answers

python multiprocessing - Best way to initialize/pass database connection to be used across processes

I am having some difficulty in passing a database connection object or the cursor object using pool.map in the Python multiprocesing package. Basically, I want to create a pool of workers each with its own state and a db connection, so that they can…
Angela
  • 1,671
  • 3
  • 19
  • 29
5
votes
1 answer

Does Objective-C use string pooling?

I know that Java and C# both use a string pool to save memory when dealing with string literals. Does Objective-C use any such mechanism? If not, why not?
Barjavel
  • 1,626
  • 3
  • 19
  • 31
5
votes
1 answer

Suggestions on improving this simple object pool class for Java?

I am currently writing a game for android where there are enemies that fly across the screen and then disappear, to be replaced by other enemies. Now, this happens very fast, and my code currently performs a lot of memory allocation and deallocation…
Lanaru
  • 9,421
  • 7
  • 38
  • 64
5
votes
2 answers

How to loop select() to poll for data ad infinitum

#include #include #include #include int main () { char name[20]; fd_set input_set; struct timeval timeout; int ready_for_reading = 0; int read_bytes =…
azrahel
  • 1,143
  • 2
  • 13
  • 31
5
votes
2 answers

Python Multiprocessing: How to add or change number of processes in a pool

I have created a pool from the python multiprocessing module and would like to change the number of processes that the pool has running or add to them. Is this possible? I have tried something like this (simplified version of my code) class foo: …
sdiemert
  • 51
  • 1
  • 4
4
votes
1 answer

What simple mechanism for synchronous Unix pooled processes?

I need to limit the number of processes being executed in parallel. For instance I'd like to execute this psuedo-command line: export POOL_PARALLELISM=4 for i in `seq 100` ; do pool foo -bar & done pool foo -bar # would not complete until the…
Jé Queue
  • 10,359
  • 13
  • 53
  • 61
4
votes
4 answers

optimal java threadsafe object pooling

I am not that familiar with the concurrent library of Java, so for the following problems I would normally just write my own mutex governed code, but I am concerned that with servlet traffic, the mutexes will slow down the system. The first need is…
Andy Nuss
  • 745
  • 1
  • 7
  • 20
4
votes
1 answer

C3P0 Creating too many Threads and Timers

I have a Java webapp running on Tomcat, with Hibernate and C3P0. All entity classes and JPA Controllers were done with Netbeans wizzard. There is a servlet that when called inserts many objects in the database (using the JPA controllers). The…
Ezequiel
  • 1,186
  • 2
  • 11
  • 11
4
votes
1 answer

Python multiprocessing pool inside daemon process

I opened up a question for this problem and did not get a thorough enough answer to solve the issue (most likely due to a lack of rigor in explaining my issues which is what I am attempting to correct): Zombie process in python multiprocessing…
Aaron Robinson
  • 406
  • 1
  • 6
  • 13
4
votes
2 answers

Using Pool.map with a list : TypeError: '<=' not supported between instances of 'list' and 'int'

I m trying to accelerate my code so I use : pool = Pool(cpu_count()-1) print('Start multi process') res = pool.map(max_def_in_circle, range(len(dataT)), All_index_in_c) with All_index_in_c is a list of list : here a preview [[2, 12], [11, 25, 26,…
Equinox
  • 91
  • 1
  • 6
4
votes
0 answers

Knex.js - how to use max number of connections in pool

I am using Knex.js with MySQL and would like to utilize a connection pool, as the test is under heavy load. Even though I have set the pool.max to 10, I never see more than 1 connection being used. Here is an example that runs a query every 100ms: …
Ben
  • 6,026
  • 11
  • 51
  • 72
4
votes
2 answers

Is it a good practice to close my connection after Sequelize operations?

currently I'm designing an app on top of Sequelize using NodeJS/TypeScript, and I'm wondering if it can cause performance issues not closing a connection. For instance, in a micro service, I need data from 1 entity. const resolver = async (,,{db})…
dbrrt
  • 2,275
  • 4
  • 18
  • 35