-

   rss_forum_sources_ru

 - e-mail

 

 -

 LiveInternet.ru:
: 29.07.2007
:
:
: 80

:


new 4Gb

, 23 2020 . 20:01 +
:
Black_Dragon @
, , ???
, ...

- ..
, NULL .
2 x86 .
---
.
Qraizer- .
new/delete .
VS2008 Express, WinXP Home Sp3
:

    // ---------------------------------------------------------------------------------
    // new.
    inline void* __cdecl operator new(size_t size)
    {
    char* pt = typebuff;
    size_t sizeS = ARRAYSIZE(typebuff);
    size_t n = 0;
    void* p = malloc(size);
    n = SimpleRs::addr2asc(pt, sizeS, " p=0x", p);
    pt += n; sizeS -= n;
    #ifdef _M_IX86
    n = SimpleRs::dword2dec (pt, sizeS, " size=", size);
    #endif
    #ifdef _M_AMD64
    n = SimpleRs::qword2asc (pt, sizeS, " size=0x", (unsigned long long )size);
    #endif
    ::OutputDebugStringA(typebuff);
    return p;
    }
    // ---------------------------------------------------------------------------------
    // delete.
    inline void __cdecl operator delete(void *p)
    {
    free (p);
    }
    // ---------------------------------------------------------------------------------
    int __cdecl _tmain(int argc, TCHAR **argv)
    {
    ::OutputDebugString(_T("----- vvv -----"));
    #ifdef _M_IX86
    size_t v1 = 2;
    #endif
    #ifdef _M_AMD64
    size_t v1 = 5;
    #endif
    size_t v2 = 1024;
    size_t total = v1;
    total *= v2;
    total *= v2;
    total *= v2;
    char *ptr = NULL;
    ptr = new char[total];
    ptr[0] = 'a';
    ptr[total - 1] = 'z';
    std::cout << sizeof(size_t) << '\t' << reinterpret_cast(ptr) << '\n' << ptr[0] << ptr[total - 1] << std::endl;
    delete[] ptr;
    ::OutputDebugString(_T("----- ^^^ -----"));
    }


:
user posted image
Dbgview:
user posted image
"" - -.

https://forum.sources.ru/index.php?showtopic=420846&view=findpost&p=3842356

:  

: [1] []
 

:
: 

: ( )

:

  URL