Home > Dynamic memory allocation > New version of dynamic memory software for C++

New version of dynamic memory software for C++

Since Easter, when I promised a new release of this software, I’ve been exceptionally busy in a money-earning sort of way. I’ve noticed that others are blogging less now that their business has (presumably) picked up, so I’m not alone in disappointing my readers, but that is no excuse and so I have just uploaded the software I promised.

The thing which has been blocking me is not the coding but the documentation. The latest version, which subscribers can find (if logged in) by going through the “Subscribers” page to the “Download” page, still does not have its documentation, but I could wait no longer. By reading the previous documentation (the old version is still there) and extrapolating it should be possible to see what’s new. Of course the code itself is commented and there are a few notes below for guidance…

  1. I fixed the problem which I blogged about before. That was the one brought to my attention by the GNU compiler. I tested my fix with that compiler but please be aware that changes I have made since then have been tested only with VC++, so far.
  2. The “specialised” template class, which required the user to set up each pool using rather nasty syntax, has gone. Naturally, the associated demo has gone, too.
  3. Instead of using static arrays, each pool now acquires its initial memory from a memory source. This can be the standard heap, if you really must retain that in your system (more on this later). Alternatively, a much simpler and better performing memory source is available in MemSpace.cpp. By including this in the build, you automatically disable the standard global operator new. There are several options concerning the memory source, but I’ll cover that whole subject in another post.
  4. As well as Pooled classes, you can now have Managed classes, which too are pooled but which must be created and managed through a kind of auto_ptr. Again, more on this later.

It’s nice to be blogging again, but now I need sleep!

Till soon.

Advertisements
  1. Prasanth
    Monday, May 10, 2010 at 04:21

    Appreciate your efforts!

  2. Monte
    Thursday, May 13, 2010 at 16:31

    The best tool to avoid memory leaks in C++ apps is Deleaker ( http://deleaker.com/ )

    • Peter Bushell
      Thursday, May 13, 2010 at 19:08

      Thanks for the recommendation, Monte. I use VC++ a lot for developing and prototyping my code, even though it is invariably destined for some embedded system using a different tool chain. Memory leaks are hard to find, and tools to find them tend to exist only for IT-type toolchains – another good reason to use such toolchains for prototyping and initial debugging, where possible.

      My code, which you can download if you wish, can’t detect or prevent the coding errors which cause memory leaks but definitely can get rid of the fragmentation problem inherent in all heap (variable block size) allocation systems. No tool can help you with this! IT programmers can generally ignore fragmentation and get away with it; embedded programmers most certainly cannot.

      Actually, I lied. The Managed class and its associated smart Ptr class are now part of my software bundle and proper use of these can help greatly to prevent memory leaks.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: