[Haskell-iPhone] Automatically freeing function pointers

Stephen Blackheath [to GHC-iPhone] likeliest.complexions.stephen at blacksapphire.com
Sun Jun 19 22:32:59 CEST 2011


David,

In GHC-iPhone the number of function pointers that are allowed to be 
active for a given function is limited, but you can change the size of 
the limit.  This is documented in

http://projects.haskell.org/ghc-iphone/downloads/GHC-iPhone.pdf

on p5 under 'Pool sizes for foreign function "wrapper" callbacks'.


Steve

On 18/06/11 11:29, David Pollak wrote:
> Howdy,
>
> I tried to build a function that would create an auto-freeing function
> pointer:
>
> runOnMain :: IO () -> IO ()
> runOnMain todo = do
>                    func <- funky
>                    dispatchFunc func
>    where funky =  mkStrCB $ \v -> do
>                                     todo
>                                     func <- funky
>                                     freeHaskellFunPtr func
>
> Unfortunately, I wind up getting:
>   internal error: iPhoneCreateAdjustor - adjustor pool 'Main_d2K2' is
> empty (capacity 32)
>      (GHC version 6.10.4-iphone-simulator for i386_apple_darwin)
>
> I'm not sure why, but I suspect that funky is being called recursively
> and thus stuff is never being freed.
>
> Any hints as to the issue and solutions?
>
> Thanks,
>
> David
>
>
> --
> Lift, the simply functional web framework http://liftweb.net
> Simply Lift http://simply.liftweb.net
> Follow me: http://twitter.com/dpp
> Blog: http://goodstuff.im
>
>
>
> _______________________________________________
> iPhone mailing list
> iPhone at haskell.org
> http://www.haskell.org/mailman/listinfo/iphone



More information about the iPhone mailing list