1 {-# LANGUAGE ForeignFunctionInterface #-}
4 module Mate.GarbageAlloc where
14 -- unified place for allocating Memory
15 -- TODO: implement GC stuff ;-)
17 mallocClassData :: Int -> IO (Ptr a)
18 mallocClassData size = do
19 printfStr "mallocClassData: %d\n" size
22 mallocString :: Int -> IO (Ptr a)
23 mallocString size = do
24 printfStr "mallocString: %d\n" size
27 foreign export ccall mallocObject :: Int -> IO CPtrdiff
28 mallocObject :: Int -> IO CPtrdiff
29 mallocObject size = do
30 ptr <- mallocBytes size
31 printfStr "mallocObject: %d\n" size
32 return $ fromIntegral $ ptrToIntPtr ptr