Error while trying to allocate memory (malloc)

CrudOMatic crudomatic at gmail.com
Mon Aug 6 07:55:04 PDT 2012


On Monday, 6 August 2012 at 14:14:12 UTC, Eyyub wrote:
> On Monday, 6 August 2012 at 13:59:35 UTC, CrudOMatic wrote:
>> On Monday, 6 August 2012 at 13:22:08 UTC, Minas Mina wrote:
>>> Maybe you need a cast before malloc to convert it to a 
>>> "s_blockInfo*"?
>>
>> Just did, and compiled. Errored out with (from my IDE):
>>> (9:54:32 AM) AccessViolation-Exception
>>> (9:54:32 AM) c0000005
>>> (9:54:32 AM)  Exception in debugger client (9:54:32 AM) 
>>> IDebugEventCallbacks::Exception
>>> (9:54:32 AM)  callback.
>>> (9:54:32 AM)       PC: (9:54:32 AM) 09239f05
>>> (9:54:32 AM)   VA: (9:54:32 AM) 00000000
>>> (9:54:32 AM)   R/W: (9:54:32 AM) 0
>>> (9:54:32 AM)   Parameter: (9:54:32 AM) 00000000
>>> (9:54:32 AM) (9:54:32 AM) Program execution halted...
>>
>> Running it directly gives me:
>>
>> object.Error: Access Violation
>> ----------------
>> I:\Prog\Projects\D\resource-cache\resource-cache\main.d(13): D 
>> main
>> ----------------
>
> You get an Access Violation error because `m_blockList` is null.

So, do I use new or what? In C it was just declare and go...


More information about the Digitalmars-d-learn mailing list