![]() ![]() Our product does a lot of string building, and using pools showed significant performance improvements. We're using pools of char and byte, and we maintain separate "bins" of sizes in the pool (for example, we always allocate arrays of size that are powers of two). One of the advantages of using a pool is that you can track the allocation frequency and totals, and you can adjust things accordingly. If you're worried about the pool getting too large (and thus wasting memory), you can either remove an arbitrary number of objects from the pool on a regular basis, or use weak references (for example, using ). ![]() This will also save a small amount of time over pure allocation because Java doesn't have to clear ( bzero) the object. When you need a new object, grab one from the pool or allocate a new one if the pool is empty. When your object is no longer needed, throw it into the pool. What we ended up doing and what I recommend to you is to maintain a pool of objects. Even when calling System.gc() directly, this was still a huge problem (both in 1.5 and 1.6 VMs)! Jprofiler find garbage collector algorithm free#The GC doesn't seem to realize that if it frees up the tiny object, it can then free the larger object. The problem is more pronounced when the tiny objects have pointers to larger objects (e.g. When making a lot of tiny objects that quickly get thrown away, the garbage collector can't keep up. But why? I thought that the elements from the old trees would no longer be accessible and their memory would be cleaned up. What I'm thinking is that the garbage collector isn't getting rid of the old trees once I do tree = new AVL Tree(). I tried 2048m and again, it wouldn't work. I increased the available heap space with -Xmx in the command line to 1024m and it didn't even complete the tests with 200000. When I tried 200000, I ran out of heap space. The problem is, I can only get as far as 100000. This should be done 2000 times, each time for 1000 elements. Each one should be tested an average of 14 times, and the 2 lowest/highest values removed from to compute the average. ![]() inser the data from the next distribution insert the data from the first distribution I have this class and I'm testing insertions with different data distributions. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |