digitalmars.D.learn - In what situation can new Struct() return null?
- faissaloo (5/5) May 10 2019 My program contains the following statement:
- Cym13 (4/9) May 10 2019 Could you share a complete, concise, compilable example
- faissaloo (3/13) May 10 2019 Unfortunately not, I can't seem to reproduce it outside my
- H. S. Teoh (13/27) May 10 2019 Perhaps try Dustmite on it?
- faissaloo (7/17) May 11 2019 I've tried a number of different compilers and the issue
- Jonathan M Davis (7/26) May 11 2019 learn wrote:
My program contains the following statement: auto newChildNode = new Node(); In debugging I have found that this pointer evaluates to null, what could cause this? I should have plenty of memory, my only other idea is some sort of heap corruption.
May 10 2019
On Friday, 10 May 2019 at 10:11:51 UTC, faissaloo wrote:My program contains the following statement: auto newChildNode = new Node(); In debugging I have found that this pointer evaluates to null, what could cause this? I should have plenty of memory, my only other idea is some sort of heap corruption.Could you share a complete, concise, compilable example demonstrating that bug? One line is rather short to understand what's happening.
May 10 2019
On Friday, 10 May 2019 at 12:19:29 UTC, Cym13 wrote:On Friday, 10 May 2019 at 10:11:51 UTC, faissaloo wrote:Unfortunately not, I can't seem to reproduce it outside my codebase.My program contains the following statement: auto newChildNode = new Node(); In debugging I have found that this pointer evaluates to null, what could cause this? I should have plenty of memory, my only other idea is some sort of heap corruption.Could you share a complete, concise, compilable example demonstrating that bug? One line is rather short to understand what's happening.
May 10 2019
On Fri, May 10, 2019 at 05:32:25PM +0000, faissaloo via Digitalmars-d-learn wrote:On Friday, 10 May 2019 at 12:19:29 UTC, Cym13 wrote:Perhaps try Dustmite on it? AFAIK, calling new on a struct should never return null. So there must be something else not quite right here. But without actual code it's anybody's guess as to what it might be. The last time I heard somebody run into this, it was caused by some unrelated compiler codegen bug that left the CPU registers in an inconsistent state, thus causing an unrelated call to `new` to return the wrong value. Perhaps you could try a different compiler to see if that makes a difference? T -- The fact that anyone still uses AOL shows that even the presence of options doesn't stop some people from picking the pessimal one. - Mike EllisOn Friday, 10 May 2019 at 10:11:51 UTC, faissaloo wrote:Unfortunately not, I can't seem to reproduce it outside my codebase.My program contains the following statement: auto newChildNode = new Node(); In debugging I have found that this pointer evaluates to null, what could cause this? I should have plenty of memory, my only other idea is some sort of heap corruption.Could you share a complete, concise, compilable example demonstrating that bug? One line is rather short to understand what's happening.
May 10 2019
On Friday, 10 May 2019 at 17:54:44 UTC, H. S. Teoh wrote:Perhaps try Dustmite on it? AFAIK, calling new on a struct should never return null. So there must be something else not quite right here. But without actual code it's anybody's guess as to what it might be. The last time I heard somebody run into this, it was caused by some unrelated compiler codegen bug that left the CPU registers in an inconsistent state, thus causing an unrelated call to `new` to return the wrong value. Perhaps you could try a different compiler to see if that makes a difference? TI've tried a number of different compilers and the issue persists, I think the issue is the garbage collector. This issue did have spontaneously disappear but generally with my project there seem to be a number of memory corruption issues that as far as I can tell, shouldn't be happening. I've submitted a bug report here: https://issues.dlang.org/show_bug.cgi?id=19860
May 11 2019
On Friday, May 10, 2019 11:54:44 AM MDT H. S. Teoh via Digitalmars-d-learn wrote:On Fri, May 10, 2019 at 05:32:25PM +0000, faissaloo via Digitalmars-d-learn wrote:If the GC fails to allocate, it will throw an OutOfMemoryError. So, new should never return null. I have no clue what could be happening in this case. - Jonathan M DavisOn Friday, 10 May 2019 at 12:19:29 UTC, Cym13 wrote:Perhaps try Dustmite on it? AFAIK, calling new on a struct should never return null. So there must be something else not quite right here. But without actual code it's anybody's guess as to what it might be.On Friday, 10 May 2019 at 10:11:51 UTC, faissaloo wrote:Unfortunately not, I can't seem to reproduce it outside my codebase.My program contains the following statement: auto newChildNode = new Node(); In debugging I have found that this pointer evaluates to null, what could cause this? I should have plenty of memory, my only other idea is some sort of heap corruption.Could you share a complete, concise, compilable example demonstrating that bug? One line is rather short to understand what's happening.
May 11 2019