Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Garbage Collector question?
- From: yogesh@xxxxxxxxx (Yogesh Pandeya)
- Subject: Garbage Collector question?
- Date: Tue, 30 Nov 1999 20:05:15 -0000
Hi Monaco, Its not memory pool, it is Object pool. The pool manager holds those = objects for you and gives you on request. You use them and return them = back to the manager. During the initialization, those objects are = created and stored with the manager. You must take care to return those = objects to the manager after using them. For example, suppose you need an array of N objects for some processing = which you do repeatedly. If you create this array everytime you do the = processing, it will result in poor time as well as memory performance as = they will have to be garbage collected after use. To save time and = memory, what you do is that you request the pool manager to create an = array of N objects for you during initialization. Whenever you need to = use the array, you request the manager to pass it on to you, you use it = and pass it back to the manager so that you get it next time you need = it. This way you save on time and memory. Hope this helps you, cheers, yogesh -----Original Message----- From: Luigi Monaco [SMTP:lm@xxxxxxxxx] Sent: Tuesday, November 30, 1999 8:36 PM To: Yogesh Pandeya Subject: RE: Garbage Collector question? hi yogesh, ? how would you create yourself a memory pool for possible allocation without dealing with vm options in startup Zdys At 07:14 PM 11/30/99 -0000, you wrote: >Hi Shrihari, >When you start a VM, it gets some initial memory from the system. It differs from VM to VM and version to version. That is the default size = of the VM's memory. You can change the initial memory using -Xms option = while starting the VM. >Now whenever you do a "new", it is a *potential* trigger for gc, but = not always neccessary. when the VM starts running out of memory because of object creation, it tries to first collect some garbage and allocate = memory to objects. If it still requires more memory, it gets it from the system(underlying OS) and runs with higher memory. this newly acquired memory is not returned back to the system till VM runs. You can check = this by using runtime total memory and free memory. You will find the total memory increasing as you create more objects without assigning it to = null.=20 > >The idea behind object pool is that if you know that you are going to create large number of objects again and again for some processing, you create a pool (or bucket) of objects at the time of initialization. = during run time you take the objects from the bucket, use them for your = purpose, and return them to the bucket. For this you have a pool manager which is initialized in the begining and you request the manager to create = objects (you will need down the line during run time) during initialization. = During run time you request those objects from the manager, initialize them as needed, and return them to the manager after use. This saves a lot of = you time for object creation. The objects created in the pool are not temporary. They satay with you for the application lifetime unless you = have methods in the manager to specifically destroy them.(setting them to = null) public development flow(information[] _void) luigi monaco 0173-3259618 icaro software gmbh 06103-944199 --- To unsubscribe, mail advanced-java-unsubscribe@xxxxxxxxxxxxxxxx To get help, mail advanced-java-help@xxxxxxxxxxxxxxxx
- Prev by Date: image query...
- Next by Date: Find the root of a class path
- Previous by thread: Garbage Collector question?
- Next by thread: java decompiler
- Index(es):