<commit_before>library AllocT /* v1.0.1.2
*************************************************************************************
*
*	*/ uses /*
*
*		*/ ErrorMessage /*
*		*/ Table		/*
*
************************************************************************************
*
*	module AllocT
*
*		Fields
*		-------------------------
*
*			readonly boolean isAllocated
*
*		Methods
*		-------------------------
*
*			static method allocate takes nothing returns thistype
*			method deallocate takes nothing returns nothing
*
*			debug static method calculateMemoryUsage takes nothing returns integer
*			debug static method getAllocatedMemoryAsString takes nothing returns string
*
************************************************************************************/
	module AllocT
		private static Table recycler
		private static integer instanceCount = 0
		
		method operator isAllocated takes nothing returns boolean
			return recycler[this] == -1
		endmethod
		
		static method allocate takes nothing returns thistype
			local thistype this = recycler[0]
			
			if (this == 0) then
				set this = instanceCount + 1
				set instanceCount = this
			else
				set recycler[0] = recycler[this]
			endif
			
			debug set recycler[this] = -1
			
			return this
		endmethod
		
		method deallocate takes nothing returns nothing
			debug call ThrowError(recycler[this] != -1, "AllocT", "deallocate", "thistype", this, "Attempted To Deallocate Null Instance.")
			
			set recycler[this] = recycler[0]
			set recycler[0] = this
		endmethod
		
		private static method onInit takes nothing returns nothing
			set recycler = Table.create()
		endmethod
		
		static if DEBUG_MODE then
			static method calculateMemoryUsage takes nothing returns integer
				local integer start = 1
				local integer end = 8191
				local integer count = 0<commit_msg>fixed debug mode<commit_after>library AllocT /* v1.0.1.2
*************************************************************************************
*
*	*/ uses /*
*
*		*/ ErrorMessage /*
*		*/ Table		/*
*
************************************************************************************
*
*	module AllocT
*
*		Fields
*		-------------------------
*
*			readonly boolean isAllocated
*
*		Methods
*		-------------------------
*
*			static method allocate takes nothing returns thistype
*			method deallocate takes nothing returns nothing
*
*			debug static method calculateMemoryUsage takes nothing returns integer
*			debug static method getAllocatedMemoryAsString takes nothing returns string
*
************************************************************************************/
	module AllocT
		private static Table recycler
		private static integer instanceCount = 0
		
		method operator isAllocated takes nothing returns boolean
			return recycler[this] == -1
		endmethod
		
		static method allocate takes nothing returns thistype
			local thistype this = recycler[0]
			
			if (this == 0) then
				set this = instanceCount + 1
				set instanceCount = this
			else
				set recycler[0] = recycler[this]
			endif
			
			set recycler[this] = -1
			
			return this
		endmethod
		
		method deallocate takes nothing returns nothing
			debug call ThrowError(recycler[this] != -1, "AllocT", "deallocate", "thistype", this, "Attempted To Deallocate Null Instance.")
			
			set recycler[this] = recycler[0]
			set recycler[0] = this
		endmethod
		
		private static method onInit takes nothing returns nothing
			set recycler = Table.create()
		endmethod
		
		static if DEBUG_MODE then
			static method calculateMemoryUsage takes nothing returns integer
				local integer start = 1
				local integer end = 8191
				local integer count = 0
{'fraction_non_alphanumeric': 0.2228899207866703, 'fraction_numerical': 0.010925976509150505, 'mean_word_length': 3.498771498771499, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7122036', 'n_tokens_mistral': 1126, 'n_tokens_neox': 909, 'n_words': 318}