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
7
votes
4 answers

Best way to manage a pool of resources in Clojure

I have a a web service endpoint that uses a mutable resource from a Java library. That web service endpoint can receive multiple queries at the same time. (the endpoint is implemented using Ring/Compojure). Creating these resources is costly, so…
Neoasimov
  • 1,111
  • 2
  • 10
  • 17
7
votes
1 answer

Multiprocessing pool and queues

I am using multiprocessing with pools. I need to pass a structure as argument to a function that has to be used in separate processes. I am facing an issue with the mapping functions of the multiprocessing.Pool, since I cannot duplicate neither…
kaligne
  • 3,098
  • 9
  • 34
  • 60
7
votes
3 answers

Python multiprocessing Pool recovery after "Resource temporarily unavailable"

If I create a Pool with an unacceptably-high number of processes while in the Python interpreter, it will obviously error-out, however it doesn't seem like the forked processes are cleaned-up before doing so, therefore leaving the environment dirty,…
Dustin Oprea
  • 9,673
  • 13
  • 65
  • 105
7
votes
1 answer

LibGdx Object Pool for many objects of the same parent class

In my game bullets are constantly created, therefore I want to use Pool class for this. However, the problem is that I have many types of bullets. All of them extend the same parent class Projectile. Currently there are 19 types of bullets. It's a…
draziw
  • 321
  • 3
  • 13
7
votes
5 answers

String Pool: "Te"+"st" faster than "Test"?

I am trying some performance benchmark regarding String Pool. However, the outcome is not expected. I made 3 static methods perform0() method ... creates a new object every time perform1() method ... String literal "Test" perform2() method ...…
pitschr
  • 529
  • 1
  • 6
  • 13
6
votes
1 answer

Python Multiprocessing - Just not getting it

I've been spending some time trying to understand multiprocessing, though its finer points evade my untrained mind. I've been able to get a pool to return a simple integer, but if the function doesn't just return a result like all of the examples I…
squid808
  • 1,430
  • 2
  • 14
  • 31
6
votes
1 answer

Get reference to Python dict key

In Python (3.7 and above) I would like to obtain a reference to a dict key. More precisely, let d be a dict where the keys are strings. In the following code, the value of k is potentially stored at two distinct locations in memory (one pointed to…
DustByte
  • 651
  • 6
  • 16
6
votes
2 answers

Python multiprocessing apply_async "assert left > 0" AssertionError

I am trying to load numpy files asynchronously in a Pool: self.pool = Pool(2, maxtasksperchild = 1) ... nextPackage = self.pool.apply_async(loadPackages, (...)) for fi in np.arange(len(files)): packages = nextPackage.get(timeout=30) #…
Doidel
  • 319
  • 8
  • 23
6
votes
2 answers

Multiprocessing Pool - how to cancel all running processes if one returns the desired result?

Given the following Python code: import multiprocessing def unique(somelist): return len(set(somelist)) == len(somelist) if __name__ == '__main__': somelist = [[1,2,3,4,5,6,7,8,9,10,11,12,13,2], [1,2,3,4,5], [1,2,3,4,5,6,7,8,9,1],…
Daniyal
  • 885
  • 3
  • 16
  • 28
6
votes
2 answers

Python multiprocessing.Pool does not start right away

I want to input text to python and process it in parallel. For that purpose I use multiprocessing.Pool. The problem is that sometime, not always, I have to input text multiple times before anything is processed. This is a minimal version of my code…
the
  • 361
  • 3
  • 9
6
votes
2 answers

python multiprocessing, big data turn process into sleep

I'm using python 2.7.10. I read lots of files, store them into a big list, then try to call multiprocessing and pass the big list to those multiprocesses so that each process can access this big list and do some calculation. I'm using Pool like…
odeya
  • 69
  • 6
6
votes
1 answer

Why A single Jedis instance is not threadsafe?

https://github.com/xetorthio/jedis/wiki/Getting-started using Jedis in a multithreaded environment You shouldn't use the same instance from different threads because you'll have strange errors. And sometimes creating lots of Jedis instances is not…
BoTaoLiu
  • 65
  • 1
  • 5
6
votes
5 answers

Buffer pool management using C#

We need to develop some kind of buffer management for an application we are developing using C#. Essentially, the application receives messages from devices as and when they come in (there could be many in a short space of time). We need to queue…
rbrayb
  • 46,440
  • 34
  • 114
  • 174
6
votes
2 answers

Would a connection Pool benefit a multithreaded Java program

I have a java process that starts about 60 threads that each access a MySql database. Would I benefit from using a Connection Pool like C3P0? Or is it meant only for Web apps (that scale to lots of users) ? Today we have long-living JDBC Connections…
Peter Andersson
  • 1,947
  • 3
  • 28
  • 44
6
votes
1 answer

boost pool_alloc

Why is the boost::fast_pool_allocator built on top of a singleton pool, and not a separate pool per allocator instance? Or to put it another way, why only provide that, and not the option of having a pool per allocator? Would having that be a bad…
mr grumpy
  • 1,513
  • 1
  • 10
  • 17