digitalmars.D.learn - core.exception.InvalidMemoryOperationError (0) on File Reading.
- David DeWitt (25/25) Jun 22 2015 I am getting an core.exception.InvalidMemoryOperationError@(0)
- Adam D. Ruppe (8/8) Jun 22 2015 Where is your code found? InvalidMemoryOperationError usually
- anonymous (12/20) Jun 22 2015 You may be hitting issue 14005/14578 with the underlying issue
- David DeWitt (6/12) Jun 23 2015 I have had a chance to try the new phobos. Dealing with the
- David DeWitt (3/17) Jun 24 2015 I pulled down the latest version on Github and everything ran
I am getting an core.exception.InvalidMemoryOperationError (0) auto recs = f // Open for reading .byLineCopy(); .array; //Here is where is appears to be happening. I have narrowed it down to the .array. I am wondering if there is some common issue I may be experiencing or if there is a better solution? Here is what I am overall trying to achieve. auto recs = f // Open for reading .byLineCopy; .array(); .map!(a=> assocArray(zip(h1.fullHeader, splitter(a,',')))) .map!(a=>a.byKeyValue() .filter!(a=>h1.filteredHeader.canFind(a.key))); foreach(item;recs){ auto item = Json.emptyObject; each!((k)=> item[k.key] = k.value)(item); insert(item, dateIndex); //ElasticSearch } Also any suggestions on the code are greatly appreciated :)
Jun 22 2015
Where is your code found? InvalidMemoryOperationError usually props up in code running from a destructor. If the call to .array isn't in a destructor, it might also be that the array is triggering a GC cycle... which calls something in a destructor. Since that's so commonly the cause I encourage you to audit your classes and make sure none of them try to new any memory in their ~this() {}...
Jun 22 2015
On Monday, 22 June 2015 at 20:30:40 UTC, David DeWitt wrote:I am getting an core.exception.InvalidMemoryOperationError (0) auto recs = f // Open for reading .byLineCopy(); .array; //Here is where is appears to be happening. I have narrowed it down to the .array. I am wondering if there is some common issue I may be experiencing or if there is a better solution?You may be hitting issue 14005/14578 with the underlying issue 13856. https://issues.dlang.org/show_bug.cgi?id=14005 https://issues.dlang.org/show_bug.cgi?id=14578 https://issues.dlang.org/show_bug.cgi?id=13856 You can try using the current development version of phobos from git. I think the InvalidMemoryOperationError shouldn't happen with that anymore. If it still happens with git head phobos, it's probably not 14005/14578. Alternatively, you can use std.stdio.readln directly, but be aware of issue 13856.
Jun 22 2015
On Monday, 22 June 2015 at 20:30:40 UTC, David DeWitt wrote:I am getting an core.exception.InvalidMemoryOperationError (0) auto recs = f // Open for reading .byLineCopy(); .array; //Here is where is appears to be happening. [...]I have had a chance to try the new phobos. Dealing with the errors related to: http://forum.dlang.org/thread/mm1fdo$q5u$1 digitalmars.com in debian. Gonna mess with it some more when I have a chance.
Jun 23 2015
On Tuesday, 23 June 2015 at 18:49:59 UTC, David DeWitt wrote:On Monday, 22 June 2015 at 20:30:40 UTC, David DeWitt wrote:I pulled down the latest version on Github and everything ran fine.I am getting an core.exception.InvalidMemoryOperationError (0) auto recs = f // Open for reading .byLineCopy(); .array; //Here is where is appears to be happening. [...]I have had a chance to try the new phobos. Dealing with the errors related to: http://forum.dlang.org/thread/mm1fdo$q5u$1 digitalmars.com in debian. Gonna mess with it some more when I have a chance.
Jun 24 2015