|Anonymous | Login | Signup for a new account||2017-09-20 18:21 CEST|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0004773||OCaml||~DO NOT USE (was: OCaml general)||public||2009-04-19 16:53||2015-12-11 19:07|
|Status||closed||Resolution||no change required|
|Platform||x86_64||OS||Linux x86_64||OS Version|
|Target Version||Fixed in Version|
|Summary||0004773: Array.make uses twice the required memory|
|Description||Currently calling 'Array.make (16*1024*1024) 0' uses approximately twice the required memory. This doesn't show up immediately though : on 64bit, resident size climbs to (a bit more than) 128MB while virtual size goes up to (roughly) 230MB.|
With linux's overcommit this isn't a problem at first but when compacting, the resident size increases to match the virtual one and I run out of memory.
I tried to pinpoint the problem myself but couldn't manage.
Is it possible to reduce the memory usage ?
|Steps To Reproduce||let a = Array.make (16*1024*1024) 0 in|
let () = Gc.compact () in
|Tags||No tags attached.|
|I had forgotten about Bigarrays which have let me reduce memory usage (has been divided by three). Now, should int arrays take less memory or should the documentation be extended to warn about memory usage and point to bigarrays ?|
This is (more or less) done on purpose. Because of the incremental garbage collector, for every 10 bytes that are in use by your data, there are another 8 bytes allocated to hold the dead data that will be reclaimed by the current (or the next) GC cycle. This 80% overhead is the "space_overhead" parameter of the GC. By lowering this parameter, you can reduce memory consumption at the cost of more time spent in the GC. In your case, if you have a few very large arrays with a very long lifetime, you should be able to reduce the space overhead quite a lot without paying too much in terms of run time.
Unfortunately, I don't know of a simple way to do this automatically.
|2009-04-19 16:53||Camarade_Tux||New Issue|
|2009-04-19 23:24||Camarade_Tux||Note Added: 0004922|
|2009-04-29 15:59||doligez||Status||new => acknowledged|
|2009-05-26 17:30||doligez||Note Added: 0004972|
|2009-05-26 17:31||doligez||Status||acknowledged => confirmed|
|2012-07-11 14:54||doligez||Status||confirmed => resolved|
|2012-07-11 14:54||doligez||Resolution||open => no change required|
|2015-12-11 19:07||xleroy||Status||resolved => closed|
|2017-02-23 16:36||doligez||Category||OCaml general => -OCaml general|
|2017-03-03 17:55||doligez||Category||-OCaml general => -(deprecated) general|
|2017-03-03 18:01||doligez||Category||-(deprecated) general => ~deprecated (was: OCaml general)|
|2017-03-06 17:04||doligez||Category||~deprecated (was: OCaml general) => ~DO NOT USE (was: OCaml general)|
|Copyright © 2000 - 2011 MantisBT Group|