Understanding the JVM memory

Stumbled upon a very nice explanation of the JVM memory, including garbage collector, tuning and related errors (watch here, in french). Here are some notes. Garbage Collector The classic garbage collector (included into the standard HotSpot JVM) will clean the Young Gen in minor GCs, and the entire heap (including both Young and Tenured gen) during a full GC, which occurs less frequently than the former. Read https://stackoverflow.com/a/2129294 for some additional information:
Read more...

Test your variables!

When PHP throws you an error, there is always a reason. My dev box is set up to throw me everything it finds, and as I am working on a code that needs strong optimization, a question crossed my mind. Before I ask the question, here’s the (simplified) error-ing code: // Function is called many times (~1M) function doSomething($arrTest) { $strName = $arrTest[0]; $strType = $arrTest[1]; $strColor = $arrTest[2]; } $arrTest = array('banana', 'fruit'); doSomething($arrTest); Of course, $arrTest[2] doesn’t exist, and PHP, as friendly as it is, works perfectly, just throwing a notice.
Read more...