🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: malloc versus GlobalAlloc

#1083
From: Eyyub Volkan �ektimur
Date: Tue, 20 Nov 2007 09:41
38 lines
2973 bytes
First of all, thanks for your plain explanation. I'm tring to understand 
what heap is and you did it very simple to understand.

> No-one said that.
>
> If you're exceptionally lucky, you might get an exception, but usually
> you just get a corrupted heap. Which may lead to all sorts of
> interesting things, perhaps including two supposedly different bits of
> memory actually being the same.

yeap, i know that, not all the time exception is raised because of 
corruption. i wanted to say that an error occurs when you do that... (on 
time or in future)

> Now, note the problem - the static memory. It has to have that, just to
> be able to start somewhere to find its own memory list. But, a memory
> manager in an EXE and one in a DLL will end up using different static
> areas. So, when memory is returned that didn't come from it in the first
> place, the structures get corrupted.
>
> Yes, a memory manager could be made that did check. But such checking
> slows it down considerably - it's easier to write fast code when it is
> assumed inputs to it are correct - and would penalise everyone who does
> manage memory correctly.

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 ?

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. 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) ? 
Technical Details
Message-ID: <4742abb5@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <47429a08$1@newsgroups.borland.com> <dh75k3ptds34av2aaj6gkjcov3634j36j0@4ax.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,5bc4a8822b5c2c43
X-Google-Attributes: gid10cc67,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Eyyub Volkan �ektimur" <evcektimur@prokon.com.tr>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <47429a08$1@newsgroups.borland.com> <dh75k3ptds34av2aaj6gkjcov3634j36j0@4ax.com>
Subject: Re: malloc versus GlobalAlloc
Date: Tue, 20 Nov 2007 11:41:08 +0200
Lines: 40
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 88.248.77.154
Message-ID: <4742abb5@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1195551669 88.248.77.154 (20 Nov 2007 01:41:09 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail