In my early days of programming I often used to get memory related fatal errors in the following format:

Fatal error: Allowed memory size of &lt;some big number&gt; bytes exhausted 
(tried to allocate &lt;some small number&gt; bytes) in /path/to/filename.php 
on line &lt;some line number&gt;


I'm a little embarrassed to state that even though I have figured out how to solve them and take steps to avoid them altogether, I'm still not quite sure what exactly does the message translate to in simple words.

For example, if I get a message such as:

Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 4000 bytes) 
in ........ on line 34


As things stand at the moment, I assume it to be stating that the script consumes 67108864 bytes of data, but only 4000 bytes are available during runtime.


Am I right in my assumption?
If not, what's the correct interpretation?



Question: Trigger to create new event after insert/update creating dupes
Answer: Most likely the cause is either


You have a second trigger somewhere else in your code base on
Handoff__c that in turn does a DML update on itself  or
You have a field update on Handoff__c via a workflow that will cause the after update trigger to be reinvoked. 


You can resolve either of these by using the controlling recursive triggers recipe as shown in the SFDC doc here or here in Help doc. You may also be able to control it by tighter if statements to avoid creating the Events even if invoked twice.

This SFSE post addresses workflows and updates of greater than 200 records

Lastly, examine your debug log to see where the after update trigger on Handoff__c gets reinvoked, this may provide additional insight