Limiting the save content of file to certain size
First: Crappy indentation makes it hard to read.

Your algorithm seems unnecessarily complicated. Why not work out how many items you want to serialize and just serialize those items.

 // Work out how many items we will need to drop.
 std::size_t  countOfItems      = objectMap.size();
 std::size_t  maxNumberOfItems  = Object::maxMemoryOfObjects/sizeof(Object);

 std::size_t  advance  = (countOfItems &gt; maxNumberOfItems)
                             ? (countOfItems - maxNumberOfItems)
                             : 0;

 // Get an iterator to the first item
 // Then advance it forward the number of items we want t drop
 // These are the older items (as map is a sorted container).
 auto printer = objectMap.begin();
 std::advance(printer, advance);

 // Print all the items using std::copy and a stream iterator
 // May not work out the box for you but you should learn how to do this.
 std::copy(printer, objectMap.end(), std::ostream_iterator&lt;Object&gt;(outfile));


Memory Ownership

Your code is littered with pointers.
This is not a good idea in general (but hard to tell without more context in this case).  

RAW Pointers are very rare in C++ as they do not convey object ownership. Usually pointers are managed by some owning object that manages their lifespan (as a result you never interact with them directly but via their owning object).

You should be using containers of object (not pointers) or if you have object hierarchies then use "pointer containers" that understand their content is a pointer and can act accordingly. If you don't have pointer containers available (they are in boost) then you should at least be using smart pointers to maintain the concept of ownership.

Looks like an error:

for (const auto&amp; x : objectMap)
    outfile &lt;&lt; x.first &lt;&lt; ' ';
}


You are not serializing the object but only the ID. I think you meant:

for (const auto&amp; x : objectMap)
    outfile &lt;&lt; x.second &lt;&lt; ' ';
}


But now you also need to define:

std::ostream operator&lt;&lt;(std::ostream&amp; str, Object const&amp; data)
{
   returns str &lt;&lt; /* Serialize object */
}
std::istream operator&gt;&gt;(std::istream&amp; str, Object&amp; data)
{
   returns str &gt;&gt; /* De-Serialize object */
}


Looks like it might be an issue.

Object::totalMemoryOfObjects += sizeof(*object);


The size of an object in memory is always fixed. So you may as well count the number of objects. Note: sizeof() is computed at compile time not runtime. If you want to add up the number of bytes in things like strings you need to write your own method to do it.

But when you use operator&lt;&lt; the object is generally serialized and the number of bytes can vary (unless you write your object in binary fixed size format to the stream (but then you need to worry about machine peculiarities like endianness (so unless there is an extreme need for speed it is usually best to use a non binary format)).

Declare variables JUST before you use them

std::ofstream outfile ("Objects.txt");

// 500 lines of code not using outfile

outfile &lt;&lt; objectMap.size() &lt;&lt; std::endl;
for (const auto&amp; x : objectMap)
    outfile &lt;&lt; x.first &lt;&lt; ' ';
}


Move the declaration of outfile to the point just before you tart using it. In C++ because of constructors/destructors the side affects may allocate resources. If you don't need them don't use them so wait until you need them.

It also has the benefit of making the declaration near the code that uses it so it makes it real easy to see the type of the object you are using (as it is just there with the code).

Encapsulation

struct Person {


You seem to be making all your objects publicly accessible. This does not help encapsulation. You should make all your data members private by default. Then provide methods (which are verbs) that act on the object.

class Object
{
    static int const maxMemoryOfObjects   = 200;
    static int       totalMemoryOfObjects = 0;
    static int       lastObjectID         = 0;

    static int allocateNextAvailableID()
    {
        return ++lastObjectID;
    }
    const int ID;
    public:
        Object()
            : ID(allocateNextAvailableID())
        {}

        // define an ordering on your objects.
        friend bool operator&lt;(Object const&amp; lhs, Object const&amp; rhs)
        {
             // With an ordering you can use Object as the key.
             // in a sorted container.
             return lhs.ID &lt; rhs.ID;
        }
};

int main()
{
    std::set&lt;Object&gt;     objectSet; // No need to allow access to the ID
                                    // to external entities that do not need to know.
                                    // provide the appropriate access method (in this
                                    // case `operator&lt;()` that defines the ordering.
}