Question: Trying to add a portfolio gallery to a custom wp theme I am making. I have exhausted myself on trying to search for solutions and plugins that could even be modified some. I think one of my issues in finding a solution is that I am not entirely sure what search terms would help me find something similar to what I am trying to achieve..

As of right now, I have the following div for my navigation

```
<div id="tags" role="navigation">
<p>
<a class="portrait" href="#portrait">Portrait</a> / 
<a class="landscape" href="#landscape">Landscape</a> / 
<a class="sports" href="#sports">Sports</a> / 
<a class="nature" href="#nature">Nature</a> / 
<a class="weddings" href="#weddings">Weddings</a> / 
<a class="active" href="#">All</a>
</p>
</div>

```

Below my navigation is where I have my images div. What I would like to do is be able to select a category from the images navigation and have only those specifically tagged images show. What I don't want is to have a new page open up for that tag/selection made. I would like to have the images reorganize or fade in/out for the selected navigation.

Im sure there is a script or plugin out there that would be similar to what I am looking for. Or a little guidance/suggestion on how to best achieve this would be appreciated.

Thanks in advance.

Answer: 
You could have a memory leak if you create dependent objects inside the constructor.

In any language/environment this could cause a leak if these dependents are referenced by external entities which don't clean them up.

In JAVA and C# this WILL NOT cause a leak if the dependents are not referenced externally. The garbage collector will eventually clean then up.

In C++ this WILL CERTAINLY cause a leak if the dependents are not referenced externally. 

see Jon' answer for more possibilities: [Can constructors throw exceptions in Java?](https://stackoverflow.com/a/1371559/1037993)
It's worth adding:

1) Java distinguishes between "checked" and "unchecked" exceptions

2) Most user-defined exceptions should be "checked". This means the code won't even *compile* unless each module in the call chain either a) handles the exception, or b) explicitly marks that it can "throw" the exception