Subj : Re: the use of new; allocating memory To : borland.public.cpp.borlandcpp From : "Benjamin Pratt" Date : Wed Dec 10 2003 10:34 am > If you want to allocate directly > from Windows you can use the API calls. Unfortunately the help system on my new 'puter > is still confused so I can't find what they are. HLOCAL LocalAlloc( UINT uFlags, SIZE_T uBytes ); HGLOBAL GlobalAlloc( UINT uFlags, SIZE_T dwBytes ); LPVOID VirtualAlloc( LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect ); More info here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/base/memory_management_functions.asp When I first started windows programming, with C, I thought "why don't I just use the API?" So I replaced malloc with LocalAlloc everywhere. Later I realized that it hampered portability, was unexpected by other programmers, is more difficult to use and was limited in the number of handles it can return. I've never had need to use them again, and now, in C++, the idea of allocating an unitialized bucket of bits is completely foreign. I can't think of a use for the API functions except in writing a memory manager. .