March 22, 2018 Help debugging an core.exception.OutOfMemoryError | ||||
---|---|---|---|---|
| ||||
Hey all, When running a D program that i wrote (32bit mode, windows10), an OutOfMemory exception being thrown when executing the program: core.exception.OutOfMemoryError@src\core\exception.d(702): Memory allocation failed However there is no stack trace being generated (due to the program being out of memory). How do I figure out where in the user code the out of memory error is coming from/occurring ? Thanks in advance, Danny ps. Using Linux 64bit, this error does not occur |
March 22, 2018 Re: Help debugging an core.exception.OutOfMemoryError | ||||
---|---|---|---|---|
| ||||
Posted in reply to Danny Arends | On 03/22/2018 02:45 AM, Danny Arends wrote:
> Hey all,
>
> When running a D program that i wrote (32bit mode, windows10), an OutOfMemory exception being thrown when executing the program:
>
> core.exception.OutOfMemoryError@src\core\exception.d(702): Memory allocation failed
>
> However there is no stack trace being generated (due to the program being out of memory).
>
> How do I figure out where in the user code the out of memory error is coming from/occurring ?
>
> Thanks in advance,
> Danny
>
> ps. Using Linux 64bit, this error does not occur
I don't think you can point at any one place because it's probably really running out of memory. The fact that it's only in 32-bit suggests that you're allocating large amounts of memory (perhaps simply some arrays are getting larger) and that some values in unrelated parts of the code are mistaken to be pointers into that memory, making them "alive" in the eye of the GC.
This is a common issue with imprecise GCs like the current one that D uses. (It's highly likely that D's GC will always be imprecise because D allows casting a pointer to an integral type. For that reason, the GC cannot be sure whether your integer value 0x12345678 is a pointer or not.)
If that really is the reason, a common advice is moving to 64-bit, where the likelihood of false pointers is about 4 billion times less than happening in 32-bit. (If my math is correct. :) )
Ali
|
Copyright © 1999-2021 by the D Language Foundation