๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #1082

Re: malloc versus GlobalAlloc

#1082
From: Alan Bellingham
Date: Tue, 20 Nov 2007 09:57
42 lines
2918 bytes
"Eyyub Volkan ๏ฟฝektimur" <evcektimur@prokon.com.tr> wrote:

>so, heap is not a memory block that is given to users, it's a kind of 
>management tool i guess. so, can we say that memory manager uses heap 
>structure to give memory chunks from bigger memory allocations and also 
>manages free operations etc... Can we say that, heap is a structure to hold 
>given allocations,frees,etc... to share bigger allocation chunks taken by 
>GlobalAlloc ?

Close enough.

(Windows will have its own heap managers too - at the top end, there's
just raw memory, that GlobalAlloc will take chunks from.)

>i guess i need to check memory managers of EXE & DLLs not heaps. If all of 
>them using the same memory manager, then there will be no heap corruption 
>problem. 

The RTL provides an exported memory manager, that provides the
new/malloc/... functions from a DLL rather than from within a LIB
whereby each linked executable gets its own copy. 

>         Is there any way in borland to check that loaded DLLs and EXE are 
>using the same memory manager ? in borland is the memory manager named as 
>RTL ? or is RTL mapped to microsoft's CRT ? does borland compiler have a 
>seperate memory manager tool (that is implemented in RTL) ? 

As far as I know, you have to manually check the link options, though
it's probably also possible to use the Dependency Walker tool to see if
all the items use the RTL. I'm not sure the name of that DLL, since the
only bit of my code that does this sort of thing happens to use my own
implementation of the same idea (dating back to 1991)(Yeah, my original
version allowed memory shared between processes - that went west when I
went 32-bit.).

(http://http://www.dependencywalker.com/ for the Dependency Walker
tool.)

Alan Bellingham
-- 
Team Browns
ACCU Conference 2008: 2-5 April 2008 - Oxford, UK
Technical Details
Message-ID: <8va5k3tvcuqrfld11irdgc8tti58qgg854@4ax.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <47429a08$1@newsgroups.borland.com> <dh75k3ptds34av2aaj6gkjcov3634j36j0@4ax.com> <4742abb5@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,5bc4a8822b5c2c43
X-Google-Attributes: gid10cc67,public,usenet
X-Google-Language: ENGLISH,ASCII
From: Alan Bellingham <alan@lspace.org>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: malloc versus GlobalAlloc
Date: Tue, 20 Nov 2007 09:57:37 +0000
Organization: Private
Reply-To: alan@lspace.org
Message-ID: <8va5k3tvcuqrfld11irdgc8tti58qgg854@4ax.com>
References: <47429a08$1@newsgroups.borland.com> <dh75k3ptds34av2aaj6gkjcov3634j36j0@4ax.com> <4742abb5@newsgroups.borland.com>
X-Newsreader: Forte Agent 4.2/32.1118
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
NNTP-Posting-Host: 193.129.251.253
X-Trace: newsgroups.borland.com 1195552657 193.129.251.253 (20 Nov 2007 01:57:37 -0700)
Lines: 42
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail