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

Why do I see extra line breaks when working with python multiprocessing pool?

Example: from multiprocessing.dummy import Pool as ThreadPool def testfunc(string): print string def main(): strings = ['one', 'two', 'three', ...] pool = ThreadPool(10) results = pool.map(testfunc, strings) pool.close() …
avasin
  • 9,186
  • 18
  • 80
  • 127
3
votes
3 answers

Is it possible to execute function every x seconds in python, when it is performing pool.map?

I am running pool.map on big data array and i want to print report in console every minute. Is it possible? As i understand, python is synchronous language, it can't do this like nodejs. Perhaps it can be done by threading.. or how? finished =…
avasin
  • 9,186
  • 18
  • 80
  • 127
3
votes
1 answer

Is it possible to execute code after pool.map finished its job in python?

I want to collect time and failure messages in pool.map function calls and print them when all jobs are done. Is that possible in python? Perhaps there is some event.. or smth else... failures = [] def test(): sleep(1) global failures …
avasin
  • 9,186
  • 18
  • 80
  • 127
3
votes
1 answer

Remove and store an array item without creating garbage

I'm looking for a performant way to remove and store elements from an array. I am trying to make an object pool to reduce garbage collections calls. Just as .pop() and .unshift() remove elements from an array and return the value of that element,…
jackrugile
  • 1,653
  • 15
  • 25
3
votes
2 answers

Cant construct object with move constructor using boost object_pool

I am trying to create a object using boost object_pool, but trying to use the move constructor of the desired object, but on Visual 2013, I am always getting: error C2280: 'MyObject::MyObject(const MyObject &)' : attempting to reference a deleted…
bcsanches
  • 2,362
  • 21
  • 32
3
votes
1 answer

Why doesn't map_async() need pool.close() and pool.join()?

I wrote the following code import multiprocessing as mp import time # def f(x) : time.sleep(0.1) return pow( x, 2 ) # my_chunksize = 10 # if __name__ == '__main__': # po = mp.Pool( processes=2 ) po_res = po.map_async( f,…
usual me
  • 8,338
  • 10
  • 52
  • 95
3
votes
0 answers

Thread pool and fork in c

I have a program that executes find command with pipes and fork. When I use one main pthread and one pthread per find i have these results (for 2 find) in pstree: sysexplorer─┬─2*[find] └─{sysexplorer} when I use one main pthread and a…
Orion Papadakis
  • 398
  • 1
  • 14
3
votes
3 answers

Java String pool related doubts

I'm trying to understand how string pool works.I have gone through many sites and finally i'm more confused now. Let me put down my doubts here. Someone help me in understanding them. 1) Where does the string pool exists? In heap or in method…
Jeevi
  • 2,962
  • 6
  • 39
  • 60
3
votes
1 answer

Any good tutorials/explanations of subpools and pools in-general?

I'm looking for something to help me understand pools, and the new Ada 2012 sub-pools. I've seen the rationale example and the example at Adapower but I find they're somewhat lacking in giving you a good understanding of what's going on.
Shark8
  • 4,095
  • 1
  • 17
  • 31
3
votes
1 answer

Multiprocessing Pool inside Process time out

When ever I use the following code the pool result always returns a timeout, is there something logically incorrect I am doing? from multiprocessing import Pool, Process, cpu_count def add(num): return num+1 def add_wrap(num): new_num =…
NeonNinja
  • 450
  • 4
  • 10
3
votes
1 answer

CDI and pooling

Does CDI allows pooling in some way?Because I thought this is a feature of EJB beans but Adam Bien says in this screencast that container chooses whether to create new instance of class through reflection or use the existing one. So if I have for…
Petr Mensik
  • 26,874
  • 17
  • 90
  • 115
3
votes
5 answers

Is there a generic "Object Pool" implementation for Delphi?

I came across this while looking for a database connection pool implementation for Delphi. An object pool needs two methods: get - to acquire an object from the pool (this will create a new instance if the pool is empty or its size has not reached…
mjn
  • 36,362
  • 28
  • 176
  • 378
3
votes
2 answers

ActiveMQ's Messages being redelivered (PooledConnectionFactory misconfig suspect)

I have an application which is using spring MessageListenerContainers along with ActiveMQ. I've configured it to use PooledConnectionFactory, following activemq's documentation. My scenario is as following: Two java-app consumers (2 different…
3
votes
2 answers

Creating symbolic links in PHP/IIS 8 when using the new Application Pool Identity feature

I'm running IIS 8, Server 2012. I have a web application where the programmers want to create symbolic links. Here is some sample code: $target = 'symlink.php'; $link = 'symlink-link.php'; symlink($target, $link); echo readlink($link); I get the…
PhotographicD
  • 31
  • 1
  • 3
3
votes
0 answers

Should I use tcmalloc/jemalloc replace memory pool?

In my project, I use memory pool (boost::pool), but it eat too much memory(measured 22G), so I want to use tcmalloc/jemalloc replace memory pool, I consider the sides below: 1.performance 2.memory use I think if I use tcmalloc/jemalloc replace…
superK
  • 3,932
  • 6
  • 30
  • 54