Ketil Malde wrote: > Is it possible to detect memory (i.e. RAM, not virtual memory) size
What do you mean by "memory size"? How much RAM is installed in the system? The amount which the process is currently using? The amount which the OS might be willing to allocate to your process at any given point in time? Something else? > from inside a Haskell program (so that I can keep my program from > growing too large with consequent thrashing)? And if so, to what > degree of portability? On Linux, you can read /proc/* (e.g. /proc/meminfo) with readFile, but that isn't remotely portable (nor are any of the similar mechanims used by other systems; at least /proc isn't as inherently non-portable as reading kernel variables via /dev/kmem). getrusage() is relatively portable across Unix variants, but I don't see a binding in (the 5.04 version of) PosixProcEnv.lhs (which is where I'd expect it to live). As for the amount which the OS might be willing to allocate to your process at any given point in time, that information probably isn't available by any means. -- Glynn Clements <[EMAIL PROTECTED]> _______________________________________________ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users