Send Beginners mailing list submissions to
        beginners@haskell.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        beginners-requ...@haskell.org

You can reach the person managing the list at
        beginners-ow...@haskell.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1.  storage leak in NetSNMP? (Lieven Marchand)


----------------------------------------------------------------------

Message: 1
Date: Mon, 21 Oct 2013 09:35:15 +0000 (UTC)
From: Lieven Marchand <lieven.march...@gmail.com>
To: beginners@haskell.org
Subject: [Haskell-beginners] storage leak in NetSNMP?
Message-ID: <loom.20131021t112909-...@post.gmane.org>
Content-Type: text/plain; charset=us-ascii

Hi,

I have a small script that computes a list of network devices, directs an 
SNMP query at each of them, computes a report from the result of that query 
and prints that. I would expect that to run in constant space but instead 
memory usage keeps going up until the script is killed by the OOM killer.

Is it possible that the NetSNMP library is keeping hold of all the results 
of its session?

Here's part of my code:

analyzeSNMP :: Line -> IO()
analyzeSNMP x = do 
  snmp <- getSNMP x
  putStrLn $ getNetworks (x, snmp)

getSNMP :: Line -> IO (Either String [SnmpResult])
getSNMP line = snmpWalk snmp_version_2c (encodeUtf8 (primaryRouterLoopback   
line)) (DBC.pack "XXX") mib2

getNetworks :: (Line, Either String [SnmpResult]) -> String


main = do
  initialize
  args <- arguments
  wans <- case wanInventoryFileName args of
            Just s -> parseWANInventory s
            Nothing -> return DefaultWAN.wans
  let lines = makeLines (tail wans)
  mapM_ analyzeSNMP lines



------------------------------

Subject: Digest Footer

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners


------------------------------

End of Beginners Digest, Vol 64, Issue 33
*****************************************

Reply via email to