Send Beginners mailing list submissions to
        [email protected]

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
        [email protected]

You can reach the person managing the list at
        [email protected]

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


Today's Topics:

   1. Re:  garbage collected object (Elise Huard)
   2. Re:  garbage collected object (Elise Huard)


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

Message: 1
Date: Fri, 16 Jan 2015 11:52:39 +0100
From: Elise Huard <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] garbage collected object
Message-ID:
        <cahfycqnvjmf41abtrwjxstvwhwboguid-krxwbkbem8dgz0...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

Thanks! I knew about profiling but System.Mem.Weak is interesting, for
more specific cases!

I tried a toy example, triggering the GC manually, but I may be doing it wrong:

import System.Mem.Weak
import System.Mem (performGC)
import Control.Concurrent (threadDelay)


main :: IO ()
main = do let x = 5
              y = "done"
              z = 3
          a <- mkWeak z x (Just (putStrLn "garbage collected"))
          performGC
          threadDelay 20000000
          print y

Any tips?
Thanks,

Elise

On 14 January 2015 at 13:17, Ryan Trinkle <[email protected]> wrote:
> You can use the 'vacuum' package to explore the heap, and you can use
> System.Mem.Weak to create a reference to something that won't keep it from
> being GCed and will let you check on it later.  You can also use the
> built-in heap profiling capabilities to track things like the memory usage
> of the entire heap from moment to moment.
>
> On Wed, Jan 14, 2015 at 5:24 AM, Elise Huard <[email protected]> wrote:
>>
>> Hi,
>>
>> Maybe a stupid question: is there a way to check whether a particular
>> data structure (or set of data structures) has been garbage collected?
>> Or indirectly: is there a way to check what's still alive in the heap,
>> so that you can potentially diff from one moment to another?
>> Thanks,
>>
>> Elise Huard
>> _______________________________________________
>> Beginners mailing list
>> [email protected]
>> http://www.haskell.org/mailman/listinfo/beginners
>
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>


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

Message: 2
Date: Fri, 16 Jan 2015 12:23:11 +0100
From: Elise Huard <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] garbage collected object
Message-ID:
        <cahfycqkr4hq7w6swhh-1qmlhczqmuxipu-98a_gn0pafag9...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

Sorry, just realized I wasn't very clear:  I mean I was expecting this
bit of code to output "garbage collected" at some point :)

On 16 January 2015 at 11:52, Elise Huard <[email protected]> wrote:
> Thanks! I knew about profiling but System.Mem.Weak is interesting, for
> more specific cases!
>
> I tried a toy example, triggering the GC manually, but I may be doing it 
> wrong:
>
> import System.Mem.Weak
> import System.Mem (performGC)
> import Control.Concurrent (threadDelay)
>
>
> main :: IO ()
> main = do let x = 5
>               y = "done"
>               z = 3
>           a <- mkWeak z x (Just (putStrLn "garbage collected"))
>           performGC
>           threadDelay 20000000
>           print y
>
> Any tips?
> Thanks,
>
> Elise
>
> On 14 January 2015 at 13:17, Ryan Trinkle <[email protected]> wrote:
>> You can use the 'vacuum' package to explore the heap, and you can use
>> System.Mem.Weak to create a reference to something that won't keep it from
>> being GCed and will let you check on it later.  You can also use the
>> built-in heap profiling capabilities to track things like the memory usage
>> of the entire heap from moment to moment.
>>
>> On Wed, Jan 14, 2015 at 5:24 AM, Elise Huard <[email protected]> wrote:
>>>
>>> Hi,
>>>
>>> Maybe a stupid question: is there a way to check whether a particular
>>> data structure (or set of data structures) has been garbage collected?
>>> Or indirectly: is there a way to check what's still alive in the heap,
>>> so that you can potentially diff from one moment to another?
>>> Thanks,
>>>
>>> Elise Huard
>>> _______________________________________________
>>> Beginners mailing list
>>> [email protected]
>>> http://www.haskell.org/mailman/listinfo/beginners
>>
>>
>>
>> _______________________________________________
>> Beginners mailing list
>> [email protected]
>> http://www.haskell.org/mailman/listinfo/beginners
>>


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

Subject: Digest Footer

_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners


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

End of Beginners Digest, Vol 79, Issue 20
*****************************************

Reply via email to