I'm trying to crawl a website and insert the href that i found in a hashset, after 650 link inserted i get the exception java.lang.OutOfMemoryError: GC overhead limit exceeded.
how can i get it to work ? 

i'm putting the code below:

```
public void getPageLinks(String URL, String otherlinksSelector ) {
    if (!links.contains(URL)) {
        try {
            Document document = Jsoup.connect(URL).userAgent("Mozilla").get();
            Elements otherLinks = document.select(otherlinksSelector); 
            for (Element page : otherLinks) {
                if (links.add(URL)) {
                    System.out.println(URL);
                }
                getPageLinks(page.attr("abs:href"),otherlinksSelector);
            }
        } catch (Exception e) {
            System.err.println(e.getMessage());
        }
    }
}

```