|
Boost : |
Subject: [boost] [Root Pointer] Deterministic C++ memory manager (update)
From: Phil Bouchard (philippeb8_at_[hidden])
Date: 2017-11-15 05:40:01
Greetings,
I wanted to give an update to the community regarding the memory manager
I wrote called: Root Pointer.
I now have a working template to solve all memory leaks in C++ and C but
both requires some meta data generator. The code can be found here; it
is working but not polished:
https://github.com/philippeb8/root_ptr
In this code we can find:
- node_ptr: main class of the smart pointer / memory manager.
- root_ptr: generic derived class that includes an "iterator" and a
pointer to the name of the instance (for debugging purposes).
Also I commented some code that logs the exact location of the memory leak.
Furthermore I would like to bring some observations that I found in the
C and the C++ language:
- Pointers and iterators are not the same; i.e. pointers should point
to allocated blocks only and shouldn't have arithmetic operators while
iterators shouldn't be used to deallocate anything.
- C pointers can only point to dynamic arrays (size known at run-time).
- C++ pointers can point to both inherited objects and static arrays
(size known at compile-time). This creates a problem (see attached:
array_inherited_pointer.cpp).
- std::array<T> should have constructors with T objects that have no
default constructor.
Lastly, before I submit anything, I will have to propose a way to apply
a template function to all non-static member variables of a class. This
will require implicit meta data generation. This idea is not new as
other libraries such as Qt is based on meta data and they certainly
could make us of this. For the moment I have a parser that does the job
correctly by specializing a boost::proxy() template function but
eventually this will have to be integrated into the standards.
Hopefully this is an important milestone!
Regards,
Phil Bouchard
www.fornux.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk