diff --git a/CHANGES.md b/CHANGES.md
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -7,6 +7,13 @@
 Unreleased
 ==========
 
+0.3.1
+==========
+
+* [#311](https://github.com/serokell/xrefcheck/issues/311)
+  + Fix a "resource exhausted" crash on repositories containing a large number
+    of Markdown files.
+
 0.3.0
 ==========
 
diff --git a/src/Xrefcheck/Scan.hs b/src/Xrefcheck/Scan.hs
--- a/src/Xrefcheck/Scan.hs
+++ b/src/Xrefcheck/Scan.hs
@@ -39,7 +39,7 @@
 import Data.Reflection (Given)
 import Fmt (Buildable (..), Builder, fmtLn)
 import System.Directory (doesDirectoryExist, pathIsSymbolicLink)
-import System.Process (cwd, readCreateProcess, shell)
+import System.Process (cwd, proc, readCreateProcess)
 import Text.Interpolation.Nyan
 import Text.Regex.TDFA.Common (CompOption (..), ExecOption (..), Regex)
 import Text.Regex.TDFA.Text qualified as R
@@ -185,9 +185,9 @@
       RdmBothTrackedAndUtracked -> liftA2 (<>) getTrackedFiles getUntrackedFiles
 
     getTrackedFiles = readCreateProcess
-      (shell "git ls-files -z"){cwd = Just root} ""
+      (proc "git" ["ls-files", "-z"]){cwd = Just root} ""
     getUntrackedFiles = readCreateProcess
-      (shell "git ls-files -z --others --exclude-standard"){cwd = Just root} ""
+      (proc "git" ["ls-files", "-z", "--others", "--exclude-standard"]){cwd = Just root} ""
 
     fileLines :: String -> [String]
     fileLines (dropWhile (== '\0') -> ls) =
diff --git a/src/Xrefcheck/Scanners/Markdown.hs b/src/Xrefcheck/Scanners/Markdown.hs
--- a/src/Xrefcheck/Scanners/Markdown.hs
+++ b/src/Xrefcheck/Scanners/Markdown.hs
@@ -23,11 +23,10 @@
 import Control.Lens (_Just, makeLenses, makeLensesFor, use, (.=))
 import Control.Monad.Trans.Writer.CPS (Writer, runWriter, tell)
 import Data.Aeson (FromJSON (..), genericParseJSON)
-import Data.ByteString.Lazy qualified as BSL
+import Data.ByteString qualified as BS
 import Data.DList qualified as DList
 import Data.Reflection (Given)
 import Data.Text qualified as T
-import Data.Text.Lazy qualified as LT
 import Fmt (Buildable (..), nameF)
 import Text.HTML.TagSoup
 import Text.Interpolation.Nyan
@@ -409,18 +408,17 @@
   | otherwise        = InvalidMode x
 textToMode _         = NotAnAnnotation
 
-parseFileInfo :: MarkdownConfig -> String -> LT.Text -> (FileInfo, [ScanError 'Parse])
+parseFileInfo :: MarkdownConfig -> String -> T.Text -> (FileInfo, [ScanError 'Parse])
 parseFileInfo config pathForPrinting input
   = runWriter
   $ flip runReaderT (ExtractorCtx config pathForPrinting)
   $ nodeExtractInfo
-  $ commonmarkToNode [optFootnotes] [extAutolink]
-  $ toStrict input
+  $ commonmarkToNode [optFootnotes] [extAutolink] input
 
 markdownScanner :: Given PrintUnixPaths => MarkdownConfig -> ScanAction
 markdownScanner config root relativePath =
   parseFileInfo config pathForPrinting . decodeUtf8
-    <$> BSL.readFile rootedPath
+    <$> BS.readFile rootedPath
   where
     rootedPath = filePathFromRoot root relativePath
     pathForPrinting = mkPathForPrinting rootedPath
diff --git a/xrefcheck.cabal b/xrefcheck.cabal
--- a/xrefcheck.cabal
+++ b/xrefcheck.cabal
@@ -5,7 +5,7 @@
 -- see: https://github.com/sol/hpack
 
 name:           xrefcheck
-version:        0.3.0
+version:        0.3.1
 description:    Please see the README on GitHub at <https://github.com/serokell/xrefcheck#readme>
 homepage:       https://github.com/serokell/xrefcheck#readme
 bug-reports:    https://github.com/serokell/xrefcheck/issues
