Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory cannot be released after calling Bigarray.Genarray.change_layout. #7505

Closed
vicuna opened this Issue Mar 15, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@vicuna
Copy link
Collaborator

vicuna commented Mar 15, 2017

Original bug ID: 7505
Reporter: liang.wang
Assigned to: @damiendoligez
Status: resolved (set by @damiendoligez on 2017-03-31T15:04:23Z)
Resolution: fixed
Priority: normal
Severity: major
Platform: Mac
OS: OSX
OS Version: El Capitan
Version: 4.04.0
Fixed in version: 4.04.1+dev
Category: otherlibs
Monitored by: @hcarty

Bug description

If Bigarray.Genarray.change_layout is called upon a variable, the memory allocated for this variable will never be collected by GC. This increases the memory consumption significantly in some numerical applications.

Steps to reproduce

Test 1:
open Bigarray;;
for i = 0 to 10000 do
let x = Genarray.create float64 c_layout [|1000;1000|] in
Genarray.fill x 0.;
Gc.compact ();
done;;

Test 2:
open Bigarray;;
for i = 0 to 10000 do
let x = Genarray.create float64 c_layout [|1000;1000|] in
let y = Genarray.change_layout x fortran_layout in
Genarray.fill x 0.;
Gc.compact ();
done;;

I tested on OSX, OCaml 4.04. Test 1 is totally fine, consumes about 30MB. Test 2 is bad, memory consumption exploded (over 30GB), simply because I added change_layout function.

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Mar 31, 2017

Comment author: @damiendoligez

Fixed (with Xavier's help) in:
trunk (commits 0efcd9f and c00cc83)
4.05 (commits 1726715 and 6a702d1)
4.04 (commits 3d3b808 and 8bdb642)

@vicuna vicuna closed this Mar 31, 2017

@vicuna vicuna added the otherlibs label Mar 14, 2019

@vicuna vicuna added the bug label Mar 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.