Skip to content
This repository has been archived by the owner on Oct 2, 2020. It is now read-only.

Commit

Permalink
Update examples in README, mention PermGen space OOM condition
Browse files Browse the repository at this point in the history
Closes #55
  • Loading branch information
guns committed Nov 24, 2013
1 parent b4b5da2 commit adc69f6
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Take a namespace with a sparse ns form that won't compile:
(defn -main [& args]
(pprint args)
(io/copy (ByteArrayInputStream. (.getBytes "hello"))
(first args)))
(first args)))

Then run slamhound on it:

Expand All @@ -64,17 +64,23 @@ Running on a directory will perform the same operation on every .clj file inside

## Repl Usage

You can do it manually from the repl to avoid the slow startup time:
You can reconstruct namespaces from a repl to avoid the slow startup time:

user=> (use 'slam.hound)
user=> (require '[slam.hound :refer [reconstruct]])
nil
user=> (println (reconstruct "src/my/namespace.clj"))
(ns my.namespace
"I have a doc string."
(:use [clojure.pprint :only [pprint]])
(:require [clojure.java.io :as io])
(:require [clojure.java.io :as io]
[clojure.pprint :refer [pprint]])
(:import (java.io ByteArrayInputStream)))

Or to reconstruct files in place:

user=> (slam.hound/-main "src/my/namespace.clj")
nil
;; Reload the file in your editor to pick up changes

## Emacs Usage

The included `slamhound.el` allows for convenient access within nREPL
Expand Down Expand Up @@ -110,6 +116,18 @@ Slamhound will also not find references to fully-qualified vars or
vars resolved at runtime since it relies on detecting compilation
failures to determine when it's done.

Slamhound aggressively loads all namespaces on the classpath on first
invocation. This is computationally expensive, so first use may be slow,
though subsequent calls should be relatively quick.

This also taxes the class loading system, so there is a possibility that
the JVM may run out of PermGen space in large projects. If this happens,
try running your JVM with the following options:

```
-Xmx5g -XX:+CMSClassUnloadingEnabled -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=128M
```

## Leiningen 1.x

The `lein-slamhound` plugin is deprecated, and the `:aliases` approach
Expand Down

0 comments on commit adc69f6

Please sign in to comment.