Article View: borland.public.cppbuilder.nativeapi
Article #13269Re: Installing New TMemoryManger
From: Bob Gonder
Date: Fri, 17 Oct 2003 19:07
Date: Fri, 17 Oct 2003 19:07
22 lines
1719 bytes
1719 bytes
CC wrote:
>My program NEVER starts up with my new 'cheap' mem mgr.
>I was wondering if anyone could tell me what I'm doing wrong,
>
>void* __fastcall MyGetMem(int nbytes)
>{
> HGLOBAL memptr;
> memptr= GlobalAlloc(GMEM_MOVEABLE ,nbytes);
GMEM_MOVEABLE returns a Handle, not an address.
Need to use GlobalLock on moveable memory so the app can use it.
>void* __fastcall MyReallocMem(void *p, int nbytes)
>{
> HGLOBAL memptr;
> memptr=GlobalReAlloc( p, nbytes, GMEM_ZEROINIT);
You sure you want to take the performance hit of Zeroint?
You don't do that for Alloc, why for ReAlloc?
I think apps expect garbage, and will re-zero the zeroed memory if it
needs it zero.
Technical Details
Message-ID:
<v5f0pv4012f3ltel1dolfea683u35iq6qi@4ax.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!small1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<3f9025f1$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,ee2b0dd0938897eb X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-10-17 12:08:35 PST From: Bob Gonder <notbg@notmindspring.invalid> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: Installing New TMemoryManger Date: Fri, 17 Oct 2003 12:07:02 -0700 Organization: MindSpring Enterprises, Inc. Reply-To: notbg@notmindspring.invalid Message-ID: <v5f0pv4012f3ltel1dolfea683u35iq6qi@4ax.com> References: <3f9025f1$1@newsgroups.borland.com> X-Newsreader: Forte Agent 1.91/32.564 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 67.31.165.14 X-Trace: newsgroups.borland.com 1066417625 67.31.165.14 (17 Oct 2003 12:07:05 -0700) Lines: 24 Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!small1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail