Commit Graph
2 Commits
Author SHA1 Message Date
Claude d4d6b6099b WinMain: a program's own has a C name and is called
winbase.h declares WinMain and wWinMain, so a C++ program's definition
gets the C name the start-up code calls. An MFC program's main (from
appmainc) now calls WinMain too on Linux and macOS, so a program with
its own WinMain runs it instead of AfxWinMain; without one, the
library's WinMain runs AfxWinMain as before. memtest starts at WinMain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRRw4kkFHrrHRhkcuLw
Signed-off-by: Claude <noreply@anthropic.com>
2026-11-20 16:16:04 +00:00
Claude 615a7985b9 Add CMemoryState and the memory diagnostics
DEBUG_NEW's blocks, and CObject-derived objects in a debug build, are
tracked: a header links each into a list, guard bytes surround it, and
new blocks and kept freed ones are filled. CMemoryState checkpoints,
differences, statistics and DumpAllObjectsSince work on them, as do
AfxCheckMemory, AfxIsMemoryBlock, AfxEnableMemoryTracking,
AfxDoForAllObjects, AfxSetAllocHook, afxMemDF (delayed frees and
checking on every call) and AfxDumpMemoryLeaks, which also runs when a
program ends. As with Visual C++, a release build's AfxCheckMemory,
AfxIsMemoryBlock and AfxEnableMemoryTracking are macros.

The library replaces the global operator delete so it can free its
blocks. libc++'s is weak, so it wins there. With MinGW's libstdc++ it is
weak itself, and when the runtime's is linked first only objects are
tracked (CObject's operator delete calls into the library).
CDumpContext::m_pFile is public, as in MFC.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRUqfQ3sTcDCMdNCGGs
2026-11-08 09:48:32 +00:00