Feature/memory api

@cmr this is still WIP and I haven't tested it on windows, but anyway.