Wednesday, October 24, 2012

JVM Memory Management


JVM Memory Structure

Heap and Non-Heap Memory
The JVM memory consists of the following segments:
  • Heap Memory, which is the storage for Java objects
  • Non-Heap Memory, which is used by Java to store loaded classes and other meta-data, StringPool
  • JVM code itself, JVM internal structures, loaded profiler agent code and data, etc.


JVMMemorylayout
Heap
The JVM has a heap that is the runtime data area from which memory for all class instances and arrays are allocated. It is created at the JVM start-up.
The heap size may be configured with the following VM options:
  • -Xmx<size> - to set the maximum Java heap size
  • -Xms<size> - to set the initial Java heap size

By default, the maximum heap size is 64 Mb.
Heap memory for objects is reclaimed by an automatic memory management system which is known as a garbage collector. The heap may be of a fixed size or may be expanded and shrunk, depending on the garbage collector's strategy.
Non-Heap
Also, the JVM has memory other than the heap, referred to as non-heap memory. It is created at the JVM startup and stores per-class structures such as runtime constant pool, field and method data, and the code for methods and constructors, as well as interned Strings.
Unfortunately, the only information JVM provides on non-heap memory is its overall size. No detailed information on non-heap memory content is available.
The abnormal growth of non-heap memory size may indicate a potential problem, in this case you may check up the following:
  • If there are class loading issues such as leaked loaders. In this case, the problem may be solved with the help of Class loaders view.
  • If there are strings being massively interned. For detection of such problem, Allocation recording may be used.

Stack
The stack is the memory set aside as scratch space for a thread of execution. When a function is called, a block is reserved on the top of the stack for local variables and some bookkeeping data. When that function returns, the block becomes unused and can be used the next time a function is called. The stack is always reserved in a LIFO order; the most recently reserved block is always the next block to be freed. This makes it really simple to keep track of the stack; freeing a block from the stack is nothing more than adjusting one pointer.

Generational Collection

       When a technique called generational collection is used, memory is divided into generations, that is, separate pools holding objects of different ages. For example, the most widely-used configuration has two generations: one for young objects and one for old objects.


    Young generation collections occur relatively frequently and are efficient and fast because the young generation space is usually small and likely to contain a lot of objects that are no longer referenced. 
     Objects that survive some number of young generation collections are eventually promoted, or tenured, to the old generation. See Figure 1. This generation is typically larger than the young generation and its occupancy grows more slowly. As a result, old generation collections are infrequent, but take significantly longer to complete.


HotSpot Generations

Memory in the Java HotSpot virtual machine is organized into three generations: a young generation, an old generation, and a permanent generation.

The young generation consists of an area called Eden plus two smaller survivor spaces, as shown in Figure 2. Most objects are initially allocated in Eden.






Garbage Collection Types


When the young generation fills up, a young generation collection (sometimes referred to as a minor collection) of just that generation is performed. When the old or permanent generation fills up, what is known as a full collection (sometimes referred to as a major collection) is typically done.

Serial Collector
With the serial collector, both young and old collections are done serially (using a single CPU), in a stop-theworld fashion. That is, application execution is halted while collection is taking place

Parallel Collector
These days, many Java applications run on machines with a lot of physical memory and multiple CPUs. The parallel collector, also known as the throughput collector, was developed in order to take advantage of available CPUs rather than leaving most of them idle while only one does garbage collection work.
                        
Concurrent Mark-Sweep (CMS) Collector
For many applications, end-to-end throughput is not as important as fast response time. Young generation collections do not typically cause long pauses. However, old generation collections, though infrequent, can impose long pauses, especially when large heaps are involved. To address this issue, the HotSpot JVM includes a collector called the concurrent mark-sweep (CMS) collector, also known as the low-latency collector





Tuesday, October 9, 2012

Scorpion Sting and Anti Venom

During my recent trip to India i found a scorpion in our home and fortunately it didn't sting any one.

Here is what it looked like (in our regional language it is called "Mandragabba" )


I was told the strings are quite dangerous and it made me think what first aid options we have in case of a sting ( apart from calling the local doctor and we live in a village and needs at least couple of hours to go to a decent hospital with all the facilities).

Disclaimer: I am not a Doctor. Use the following info at your own risk.

There is an antidote (Prazosin) available in India and here are few links related to it.Here is the info on this drug and the brands that manufacture it.


USA:

In US Antivenom is available and it is called "Anascorp". It's quite costly. Though it costs a fraction in Mexico.






India


Treatment details


Tuesday, June 19, 2012

Strings i have tried so far

All these days i never paid any attention to the Strings. What ever String the racquets came with i used them.

 I String my own racquets and hence have more freedom in trying out various combinations.

And i don't break strings that often.

How ever after reading through many tennis forums i now have decent idea reg various Strings and started experimenting with various String setups.

Here is the list of Strings i am using so far :

1) Gosen OG Sheep Micro      (Synthetic String)

   Good and cheap synthetic string. Mostly used for crosses in a hybrid setup

2) Gosen polylon                      (Poly)

    First generation poly. If you have arm problems stay away from it.

3) Forten Nylon                        (Cheap Nylon String)
    Dead cheap string. Good for String breakers. Can be used as a Cross in Hybrid setup

4) Pro's Pro Hitec Multi Fibre   (Multiflament)

    Softest multi. Haven't played with it yet

5) Poly Star Classic                  (Poly)


      Stiffness Ratings


           Company           String           Material     Guage       Stiffness(lb/in)      Tension Loss(lbs)
           Ploy Star         Classic 17        Polyester         1.22                232                        22.23
           Ploy Star         Classic 16        Polyester         1.28                235                        22.14

6) Poly Star Profile                   (Poly)





Applying for Re Entry Permit

In order to apply for a Re Entry permit (after getting the Greencard).

One needs to file I-131 and here is the checklist.

1. $445 ($360 for I-131+ $85 for Bio Metric) check made out to "US Department of Homeland Security"
2. completed I-131
3. Copy of Green card
4. Copy of my Passport All Pages
5. 2 US passport photos
7. Supporting documents for travel. (Explaining the reason why i need to stay for longer period abroad).
8. Optional G-1145 Form.

I got my Re Entry permit and it is valid for two years !!.

For my it took close to two months.

Thursday, June 14, 2012

USTA League Results

I Started playing in a USTA League and so far my record is 3-1.

I am only Playing Singles (3.5). Our team hasn't lost yet !! We are 7-0.

Here are my Results so far.


Thursday, May 17, 2012

Yonex RD Ti 70 Long

I am able to get couple of Yonex RD Ti Long racquets in 7.5 condition and i am really happy with them.

I need to string one of them and waiting for my Strings to arrive from TW.

I had a hitting session and though this is the first time i played with a Yonex racquet (Box shaped head) i didn't notice any difference and i had good control over all my shots.

The one played with weighed 361gm and the unstrung one weighed  ~345gm.  These racquets are 27.5in long (half inch longer than the standard length which is 27 inch).

Here are the pics.














and it seems this racquet is discontinued and is hard to find.

Here are the specs from archived TW web site.


Head Size:
98 sq. in. / 632 sq. cm.
Length : 27.5 inches / 70 cm
Construction :
19-20 mm
Composition :
High Modulus Graphite & Titanium Mesh/Ultima Ti Shaft
Strung Weight :
12.1 ounces / 343 grams
Power Level: Low
Babolat Racquet Diagnostic
Center (RDC) Data:

Stiffness: 62 (0-100)
Inertia: 321 (200-400)
Power: B, 50 (0-100)
Control: B, 52 (0-100)
Manueverability: A, 73 (0-100)
Stroke Style: Full
Swing speed: Fast
Balance: 11pts Head Light
Racquet Color:
Red w/Black & Silver Highlights
Grip type:
Yonex Leather Grip
String Tension:
50-60 pounds
String Pattern:
18 Mains / 20 Crosses
Mains skip: 8T,10T,8H,10H
Two Piece
No shared holes

Monday, January 30, 2012

Thoughts on Superbowl Weekend

Both the games (NE Vs BAL & SF Vs NY) were really close and even though i was rooting for either NE Vs NY or BAL Vs SF super bowl i was little disappointed the way Baltimore lost to NE.

After watching Rey Lewis's post game speech (Link Here) i appreciate what it takes to be a leader and inspire others where every one is searching for the scape goat or coming up with theories what could have happened if some thing did this , referee making a mistake etc.

As Bellichick famously quoted "stats are for losers"  It's time to move on and learn from your mistakes (missed opportunities).

I will be rooting for NE against Giants and i hope they will settle the score this time and i won't have a sleepless night as it was the case in 2007.

As far as Ravens are concerned it was a great season and lot of positives..

1) Flacco stepped up big time in crucial games
2) Just need to draft good center , Left Tackle and line backers.