Re: Initialize not resetting other fields !

From: Skybuck Flying (nospam_at_hotmail.com)
Date: 02/25/04


Date: Wed, 25 Feb 2004 18:15:57 +0100


"Rob Kennedy" <me@privacy.net> wrote in message
news:c1iipv$1jbp1i$1@ID-220940.news.uni-berlin.de...
> Skybuck Flying wrote:
> > It only initializes dynamic types like strings etc...
>
> Duh. Did you read the help? "Initialize simply zeros out the memory
> occupied by long strings, Variants, and interfaces, causing long strings
> to be empty and Variants and interfaces to be Unassigned."
>
> The help neglects to mention dynamic arrays; they're initialized, too.
>
> If you want your entire memory block to be all-bits-zero, then stop
> using GetMem. Use AllocMem instead.

Note: If the memory does not need to be zero-initialized, it is more
efficient to use GetMem instead.

:)

Sometimes I don't need all bits zero or just dont want it ;) for maximum
flexibility/speed...

Thx for the tip though,

I know use:

GetMem
FillChar
AND
Initialize

Just to be on the safe side ! :D

Skybuck.



Relevant Pages

  • Re: Delphi 7/8 Language enhancements
    ... > strings, dynamic arrays, variants or interfaces. ...
    (borland.public.delphi.non-technical)
  • Re: .NET SUCKS --- READ FOLLOWING. MICROSOFT IS A SUCKY CO
    ... > system just doesn't cut it in high memory load situations. ... Garbage Collection is not an excuse for poor memory management. ... One excellent example is the use of strings. ... because many "professional" programmers know very little about what is ...
    (microsoft.public.dotnet.framework)
  • Re: Secure Credentials pwd handling
    ... strings that are produced when you read the properties. ... Co-author of "The .NET Developer's Guide to Directory Services Programming" ... so at some point the value will be in memory. ... SecureString is added to .NET to support this use case. ...
    (microsoft.public.dotnet.security)
  • Problem on CIsco 7204VXR/NPE400 ==> input errors
    ... output buffer failures, ... on the Cisco 6500, no errors. ... FastEthernet interfaces ... 20208 failures (0 no memory) ...
    (comp.dcom.sys.cisco)
  • Re: CStrings and memory
    ... Then you allocate a few more strings ... Now you need to allocate another string, but there is no more memory. ... In addition to strings, there are other things that get allocated: ... have perhaps confused "address space" with "working set". ...
    (microsoft.public.vc.mfc)