Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
June 22, 2015 core.exception.InvalidMemoryOperationError@(0) on File Reading. | ||||
---|---|---|---|---|
| ||||
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 :) |
June 22, 2015 Re: core.exception.InvalidMemoryOperationError@(0) on File Reading. | ||||
---|---|---|---|---|
| ||||
Posted in reply to David DeWitt | 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() {}... |
June 22, 2015 Re: core.exception.InvalidMemoryOperationError@(0) on File Reading. | ||||
---|---|---|---|---|
| ||||
Posted in reply to David DeWitt | 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. |
June 23, 2015 Re: core.exception.InvalidMemoryOperationError@(0) on File Reading. | ||||
---|---|---|---|---|
| ||||
Posted in reply to David DeWitt | 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. |
June 24, 2015 Re: core.exception.InvalidMemoryOperationError@(0) on File Reading. | ||||
---|---|---|---|---|
| ||||
Posted in reply to David DeWitt | 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 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.
I pulled down the latest version on Github and everything ran fine.
|
Copyright © 1999-2021 by the D Language Foundation