Hi Jaewon!
I am having some troubles with Java Heap Memory when reading data after certain sessions. When I attempt to run behaviorsummary, the following error reads out: "Error using reshape. Number of elements must not change. Use [] as one of the size inputs to automatically calculate the appropriate size for that dimension." When I attempt to open the BHV2 file, I get an OutOfMemory: Java Heap error. These errors always seem to appear together and I otherwise have no issues using behaviorsummary. The entirety of these errors is below. These errors do no always arise, and seem to when animals likely complete a high number of trials (based on reward received), but this is not always consistent. I have had animals complete 700 trials before with no issue, but on certain occasions I cannot open or run analysis on BHV2 files. After the first two times this error occurred, I increased the Java Heap Memory in Matlab, incrementally up to its maximum as the errors occurred. Even while set at maximum (2015 MB for the machines running ML), I still received the error today.
I have attached the timing and conditions files used during the session in question, as well as a zip of the BHV2 file.
Do you have any advice on how to navigate this error and prevent it from happening? I appreciate any insight you have and apologize if this is merely a result of my inexperience programming.
Thank you!
1 - Behavior Summary Error
"Error using reshape
Number of elements must not change. Use [] as one of the size inputs to automatically calculate the appropriate size for that dimension.
Error in mlbhv2/read_variable (line 277)
val = reshape(fread(obj.fid,prod(sz),['*' type]),sz); % fread can handle only a 2-d size arg.
Error in mlbhv2/read_variable (line 270)
for n=1:nfield, [a,b] = read_variable(obj); val(m).(b) = a; end %#ok<AGROW>
Error in mlbhv2/read_variable (line 270)
for n=1:nfield, [a,b] = read_variable(obj); val(m).(b) = a; end %#ok<AGROW>
Error in mlbhv2/read_trial (line 141)
[a,b] = read_variable(obj);
Error in mlread (line 29)
data = fid.read_trial();
Error in ML_Analyze (line 5)
ML_Data_Log = mlread(log_loc);"
2 - Java Heap:
Error in ML_Analyze (line 5)
ML_Data_Log = mlread(log_loc);
Exception in thread "AWT-EventQueue-0": java.lang.OutOfMemoryError: Java heap space
at org.netbeans.editor.DocumentContent.enlargeGap(DocumentContent.java:208)
at org.netbeans.editor.DocumentContent.insertText(DocumentContent.java:246)
at org.netbeans.editor.DocumentContent$Edit.undoOrRedo(DocumentContent.java:373)
at org.netbeans.editor.DocumentContent$Edit.<init>(DocumentContent.java:317)
at org.netbeans.editor.DocumentContent.insertString(DocumentContent.java:84)
at org.netbeans.editor.BaseDocument.insertString(BaseDocument.java:596)
at com.mathworks.widgets.text.PrintableDocument.insertString(PrintableDocument.java:444)
at com.mathworks.widgets.datamodel.TextFileBackingStore.loadDocumentFromFile(TextFileBackingStore.java:174)
at com.mathworks.widgets.datamodel.TextFileBackingStore.doLoad(TextFileBackingStore.java:241)
at com.mathworks.widgets.datamodel.TextFileBackingStore.doLoad(TextFileBackingStore.java:32)
at com.mathworks.widgets.datamodel.AbstractBackingStore.load(AbstractBackingStore.java:114)
at com.mathworks.mde.editor.EditorView.reload(EditorView.java:410)
at com.mathworks.mde.editor.EditorView.initSyntaxTextPane(EditorView.java:862)
at com.mathworks.mde.editor.EditorView.<init>(EditorView.java:222)
at com.mathworks.mde.editor.EditorView.<init>(EditorView.java:153)
at com.mathworks.mde.editor.EditorViewClient.init(EditorViewClient.java:226)
at com.mathworks.mde.editor.EditorViewClient.<init>(EditorViewClient.java:175)
at com.mathworks.mde.editor.MatlabEditorApplication.createEditorViewClient(MatlabEditorApplication.java:703)
at com.mathworks.mde.editor.MatlabEditorApplication.createEditorViewClient(MatlabEditorApplication.java:688)
at com.mathworks.mde.editor.MatlabEditorApplication.createEditorViewClientFromExistingFile(MatlabEditorApplication.java:680)
at com.mathworks.mde.editor.MatlabEditorApplication.access$300(MatlabEditorApplication.java:77)
at com.mathworks.mde.editor.MatlabEditorApplication$4.runWithOutput(MatlabEditorApplication.java:405)
at com.mathworks.jmi.AWTUtilities$Invoker$2.watchedRun(AWTUtilities.java:475)
at com.mathworks.jmi.AWTUtilities$WatchedRunnable.run(AWTUtilities.java:436)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
Attachments:
open |
download -
Visual_Discrimination_Task_NoInitiation_100%Conflict_Stage3.4.txt
(4.1 KB)
open |
download -
Visual_Discrimination_Task_NoInitiation.m
(6.3 KB)
open |
download -
20210318_Griffin_100%Con_ThreeBlocks_SetChange.bhv2.zip
(1.87 MB)