[windev] Memory allocation suggstion...
Chris Becke
Chris.Becke at derivco.com
Fri Aug 7 09:19:31 GMT 2009
It kind of was deprecated:
The c-runtime defined one version of malloc() that returned a pointer to locked memory. The API functions on the other hand, were needed if you wanted memory to be moveable, allocated on the Local vs Global heaps, or span more than 64Kb. And, in the days of Win16, applications needed to be able to manage memory: There were size and performance implications to choosing the wrong allocation type for memory and applications that managed their memory locking made the small quantities of non virtual memory a lot more tolerable.
________________________________________
From: windev-bounces at windev.org [windev-bounces at windev.org] On Behalf Of Serge Wautier [serge at wautier.net]
Sent: 07 August 2009 10:56 AM
To: 'Roberto Tirabassi'
Cc: 'Windows Developers (Mailing List)'
Subject: Re: [windev] Memory allocation suggstion...
Roberto,
malloc() was never deprecated. malloc() is the CRT (platform independent)
function to allocate memory in C. Each implementation of the malloc()
function in the C library uses whatever OS-specific API is required on the
targeted OS. In the case of Windows 16-bits, malloc() calls GlobalAlloc()
(which is the Win16-specific API to allocate memory), exactly as the C++ new
operator does (new also calls the object constructor).
Now, of course you can't go back in time but you asked for advice/opinions,
right? Here's mine: As much as possible, try to use standard
(platform-independent) libraries. The CRT (C) and the STL (C++) are such
libraries.
HTH,
Serge.
http://www.apptranslator.com
> -----Original Message-----
> From: Roberto Tirabassi [mailto:rtirabassi at 3di.it]
> Sent: vendredi 7 août 2009 10:44
> To: Serge Wautier
> Cc: 'Windows Developers (Mailing List)'
> Subject: Re: [windev] Memory allocation suggstion...
>
> Hi Serge,
> When I started programming in Windows, I mean in 1989 with Windows
> 16 bit, using malloc() was deprecated and GlobalAlloc() was to be used
> instead. I probably have to get back to the past... :o)
> Thanks...
>
> Roberto Tirabassi.
> --
> "Non è vero che un amico si vede nel momento del bisogno,
> un amico si vede sempre."
> [Roberto Benigni]
>
>
> 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
#############################################################################################
The information transmitted is intended only for the person or entity to which it
is addressed and may contain confidential and/or privileged material.
Any review, retransmission, dissemination or other use of, or taking of any action
in reliance upon, this information by persons or entities other than the intended
recipient is prohibited. If you received this in error, please contact the sender and
delete the material from any computer.
Furthermore, the information contained in this message, and any attachments thereto, is
for information purposes only and may contain the personal views and opinions of the
author, which are not necessarily the views and opinions of the company.
#############################################################################################
More information about the Windev
mailing list