Re[2]: [Haskell] memory management

2009-08-04 Thread Bulat Ziganshin
Hello Sigbjorn, Tuesday, August 4, 2009, 6:11:09 PM, you wrote: > this using the type system, if you so wish..) I don't know if the GHC > RTS still(?) provides hooks for allocating "alloca" objects specially. it's allocated as usual object, these are cheap anyway as far as it freed before minor

Re: [Haskell] memory management

2009-08-04 Thread Sebastian Sylvan
On Tue, Aug 4, 2009 at 2:49 PM, Simon Marlow wrote: > On 04/08/2009 13:33, Sam Martin wrote: > >> Sounds like region inference to me. >>> (https://secure.wikimedia.org/wikipedia/en/wiki/Region_inference) >>> >> >> Thanks, yes, that's exactly what I had in mind. >> >> Is anything like this is don

Re: [Haskell] memory management

2009-08-04 Thread Sigbjorn Finne
Hi, staying in the realm of the explicit and pragmatic, various libraries in Haskell do provide safe&explicit region/alloca/stack allocation actions, e.g., Foreign.Marshal.Alloc.allocaBytes :: Int -> (Ptr a -> IO b) -> IO b with the promise that the pointer doesn't escape here (you could con

Re: [Haskell] memory management

2009-08-04 Thread Simon Marlow
On 04/08/2009 13:33, Sam Martin wrote: Sounds like region inference to me. (https://secure.wikimedia.org/wikipedia/en/wiki/Region_inference) Thanks, yes, that's exactly what I had in mind. Is anything like this is done in GHC? Not at the moment, no. Bear in mind that with generational GC, a

RE: [Haskell] memory management

2009-08-04 Thread Sam Martin
> Sounds like region inference to me. > (https://secure.wikimedia.org/wikipedia/en/wiki/Region_inference) Thanks, yes, that's exactly what I had in mind. Is anything like this is done in GHC? Ta, Sam ___ Haskell mailing list Haskell@haskell.org http

Re: [Haskell] memory management

2009-08-04 Thread Gwern Branwen
On Tue, Aug 4, 2009 at 7:30 AM, Sam Martin wrote: I can picture similar situations arising in Haskell where for suitable expressions the compiler could in theory determine that garbage collection would be unnecessary for a lump of temporary data and simply allocate/deallocate when starting/finish

RE: [Haskell] memory management

2009-08-04 Thread Sam Martin
I'm not quite sure how to describe this, but are you aware of any research into converting heap allocations into frames on a stack? For example, many C functions follow this kind of pattern: void doSomeStuff(..) { // allocate required resources int a,b,c; // finite amount of

Re: [Haskell] memory management

2009-08-04 Thread Colin Runciman
Nathan, I'm interested in research relating to memory management in Haskell. I'm at the point where I don't know enough to have very specific questions, but I'm especially interested in garbage collection in Haskell, and any available statistics (such as, how long does a thunk typically