[windev] Memory allocation suggstion...

Serge Wautier serge at wautier.net
Fri Aug 7 08:19:15 GMT 2009


> Under Unix/LInux platform the old style malloc()/realloc()/free()
functions 
> are doing well their job since from the "beginning of time"

So do they in Windows! (Same for new/delete in C++ of course).
It looks like you guys reinvented a wheel named the C Runtime Library.

Cheers,

Serge.
http://www.apptranslator.com




> -----Original Message-----
> From: windev-bounces at windev.org [mailto:windev-bounces at windev.org] On
> Behalf Of Roberto Tirabassi
> Sent: vendredi 7 août 2009 10:13
> To: Windows Developers (Mailing List)
> Subject: [windev] Memory allocation suggstion...
> 
> Hi All.
> This is going to be a very silly question, or a "rookie" one, but since
> its free of any fee, I'll do it all the same! :o)
> 
> First: we write code that must be compiled on multiple platforms (say
> Windows, SunOs, Linux, MacOS, Aix and others) so the code uses as few
> "platform specific" functions as we can.
> Second: since the code we develop saw its' first light in Windows
> version, we used to create a set of wrapper functions that "emulate"
> windows methods behavior under other platforms. You can imagine, this
> way, that we wrote the "CreateFile" for unix/linux platforms, having
> same parameter than the Windows one. In some other cases we simply
> decided to create a custom method that decides how to act due to a
> #ifdef/#else/#endif internal check.
> Third: the code first born in the '80/'90, so many parts of it are
> still
> written in "old style" C.
> 
> So... Windows development in the first years of '90, still 16 bit, uses
> GlobalAlloc (and so on) and LocalAlloc (and so on) to allocate,
> reallocate and free memory, using GlobalLock and LocalLock (and Unlock
> functions) to convert Handles into valid pointers. That was needed to
> second memory manager swapping activity. When Windows NT was born,
> GlobalAlloc, but especially GlobalLock(), loosed a part of it's
> meaning.
> More: Under Unix/LInux platform the old style malloc()/realloc()/free()
> functions are doing well their job since from the "beginning of time"
> and C++ code has it's own new()/delete() methods to act as needed.
> 
> Now... in C standard code for Windows, which
> allocation/reallocation/free functions should you use? And why?
> Thanks in advance...
> 
>                            Roberto Tirabassi.
> --
> "La vendetta è un modo pigro di prolungare il proprio dolore"
> [Dal film "The Interpreter" di Sidney Pollack]
> 
> 
> Skype: roberto.tirabassi
> 
> 3D Informatica, Via Speranza 35,
> 40068, S.Lazzaro di Savena - Bologna, Italy
> Voice: +39051450844, Fax: +39051451942
> WWW: https://www.3di.it
> Documentation: https://www.3di.it/manuali/ - http://wiki.3di.it
> FTP: ftp://ftp@ftp.3di.it, Download:/3di, Upload:/incoming
> --
> 
> 
> 
> --
> Windev mailing list at Windev at windev.org
> 
> Lost your password?  Need to unsubscribe or change your delivery
> options?
> Go to http://lists.windev.org/mailman/listinfo/windev
> --
> Search the Windev Archives - www.windev.org



More information about the Windev mailing list