Re: How can I have a DLL write data to my application's form? (eg. DLLs and procedural type question)

From: Thaddy de Koning (thaddy_at_replacethiswithmyfirstname.com)
Date: 01/08/05


Date: Sat, 08 Jan 2005 11:32:38 GMT

Yes, recyclerMM does this automatically, as does MultiMM.pas another
good one.

Yes, you're right about the $CC, typo.

Yes, you could use the heap allocator functions, but no the COM memory
allocator does a lot more than you would expect at first glance: it does
maintain a systemwide reference count on the memory allocation ( maybe
in contrast to what you imply). it also makes your applications and
dll's fully com memory compliant, which means you can easily share
memory with applications written in other (COM compliant) languages and
thus can be a great (if sometimes rather ambiguous!) timesaver. As I
explained, from Delphi you'd need to make shure both dll and exe uses
this manager. The sharemem dll is a dependency I really can do without,
since the standard memory manager as well as the sharemem manager are
not very good anyway , really doesn't justify its size and can be very
disadvantageous under for example the following circumstances:
- loads of small allocations tend to fragment a lot
- The lack of proper alignment can lead to a huge speed penalty in code
for f.e. multimedia.
- Distribution of an extra dll can easily lead to screw ups from both us
and the customer.
- Applications for which the modules are written in more than one
language (actually quite a common practice)

A proper aligning memory manager can speed up your code by as much as 200%

B.t.w. the small example manager I included does nothing to solve any of
the above! It just solves the sharemem dependency.

Julian Bucknall also wrote a nice manager that solves the fragmenting
heap problem: hpdefr.pas that also is a lot faster for most code.



Relevant Pages

  • Re: Preventing memory fragmentation
    ... >The c-runtime dynamic memory manager (and most other commercial memory ... >memory is not actually freed but returned to a pool manager. ... They also sell a very good heap allocator. ...
    (comp.lang.cpp)
  • Re: Memory increases linearly
    ... my applications memory usage and VM size(shown in Task ... Manager) increases very rapidly. ... You may also want to implement a custom memory allocator (e.g. you can do ... that also for STL containers like std::vector, ...
    (microsoft.public.vc.mfc)
  • Re: How can I have a DLL write data to my applications form? (eg. DLLs and procedural type question
    ... > Yes, you could use the heap allocator functions, but no the COM memory ... > allocator does a lot more than you would expect at first glance: ... How can I create another reference to the memory that COM would know ...
    (comp.lang.pascal.delphi.misc)
  • Re: [PATCH] change gen_pool allocator to not touch managed memory
    ... The following patch modifies the gen_pool allocator to ... change is to eliminate the touching of the actual memory being allocated. ... + * Add a new chunk of memory to the specified pool. ... starting address of memory chunk to add to pool ...
    (Linux-Kernel)
  • [PATCH] [0/13] General DMA zone rework
    ... Traditionally it was designed only for ISA dma which is limited to ... On 32bit i386 with its limited virtual memory space the next zone is ... cannot actually be used for ISA or any other device with <32bit DMA mask. ... I chose to implement a new "maskable memory" allocator to solve these ...
    (Linux-Kernel)