[swift-users] hello world takes almost 1MB of RAM

Dmitri Gribenko gribozavr at gmail.com
Fri Mar 4 15:34:07 CST 2016


+Nadav

On Fri, Mar 4, 2016 at 1:30 PM, Karl Pickett via swift-users
<swift-users at swift.org> wrote:
> On ubuntu 14.4,
> $ swiftc -v
> Swift version 3.0-dev (LLVM b361b0fc05, Clang 11493b0f62, Swift 24a0c3de75)
> Target: x86_64-unknown-linux-gnu
>
> Sample program, compiled with simply "swiftc t.swift".
>
> $ cat t.swift
> import Foundation
> print("hello, world\n")
> while true {
>     sleep(1)
> }
>
> pmap -XX <pid> shows me 4870KB RSS, 880KB of which is private dirty /
> anonymous.  So every additional copy you start takes 880KB of RAM.   (Our
> use case has thousands of processes running)
>
> For compariso:
> - a dynamically linked C/glibc program takes 88KB
> - a dynamically linked C++/glibc,libstdc++ program takes 172KB
> - a statically linked C++/glibc,libstdc++ program takes 64KB
> - a statically linked musl c program takes just 16KB
>
> Is this on the roadmap for improvement?
>
> - Karl
>
>
>
>
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
>



-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/


More information about the swift-users mailing list