Can’t save WS while file mapped
Forum rules
This forum is for discussing APL-related issues. If you think that the subject is off-topic, then the Chat forum is probably a better place for your thoughts !
This forum is for discussing APL-related issues. If you think that the subject is off-topic, then the Chat forum is probably a better place for your thoughts !
Can’t save WS while file mapped
I am using the ⌷MAP function to read a binary file. When I try to save the workspace, I get an error message saying the function can’t be executed while a file is mapped. I copied the data into a matrix then copied a vector form of the data to a different variable. I erased the variable to which the data was read thinking that perhaps this is keeping the file mapped, but still got the error. How do I break the connection to the mapped file so I can save the WS?
+←--------------------------------------------------------------→
+ Jay Moskowitz
+←--------------------------------------------------------------→
+ http://www.linkedin.com/in/jay-moskowitz-5745b83
+
+ Jay Moskowitz
+←--------------------------------------------------------------→
+ http://www.linkedin.com/in/jay-moskowitz-5745b83
+
-
- Posts: 43
- Joined: Wed May 13, 2009 12:36 pm
Re: Can’t save WS while file mapped
⎕MAP produces an array that has reference semantics. Namespaces also have reference semantics.
You break these by using indexing. So
maps /dev/zero which, on Unix/Linux/MacOs, is a "file" that reads as an infinite length - all zeros.
So I now have a 3 dimensional array of shape 1 2 3 that is all null character.
The data is saved in the workspace as "b". You could equally have reused "a".
The mapping is also broken if all of the names that still reference it are reassigned.
In this case the data is not saved in the workspace. No name still references it.
You break these by using indexing. So
a←80 1 2 3 ⎕map '/dev/zero'
maps /dev/zero which, on Unix/Linux/MacOs, is a "file" that reads as an infinite length - all zeros.
So I now have a 3 dimensional array of shape 1 2 3 that is all null character.
)save ./junk.dws
Cannot perform operation with mapped files present.
b←a[;;]
⎕ex'a'
)save ./junk.dws
./junk.dws saved Mon Sep 25 11:38:54 2017
The data is saved in the workspace as "b". You could equally have reused "a".
The mapping is also broken if all of the names that still reference it are reassigned.
a←80 1 2 3 ⎕map '/dev/zero'
)save ./junk.dws
Cannot perform operation with mapped files present.
a←1
)save ./junk.dws
./junk.dws saved Mon Sep 25 12:01:14 2017
In this case the data is not saved in the workspace. No name still references it.