Ejemplo n.º 1
0
/* ---------------------------------------------------------------------------------
*  LQuickFind_GetUsedMem
*  ---------------------------------------------------------------------------------
*  GetUsedMem */
ui4 LQuickFind_GetUsedMem (LQuickFind* This)
{
	ui4 theHashTableUsedMem=0;
	ui4 theQuickFindStructUsedMem=0;
	ui4 theLArraysUsedMem=0;
	
	LArray* theItems;
	ui4 theNumItems;
	LArray** theTreePtr;
	ui4 i;
	LHash* theTmpHashTable;
	
	/*creates tmp hash table...*/
	theTmpHashTable=LHash_New ();
	
	/*size of hash table...*/
	theHashTableUsedMem=LHash_GetUsedMem (This->mHashTable);
	
	/*size of struct LQuickFind...*/
	theQuickFindStructUsedMem=sizeof (struct LQuickFind);
	
	/*size of all larrays...*/
	theItems=LHash_GetAllItems (This->mHashTable);
	theNumItems=LArray_GetItemsCount (theItems);
	for (i=0; i<theNumItems; i++)
	{	
		/*retrieves pointer to tree...*/
		theTreePtr=(LArray **)LArray_ItemAt (theItems, i);
		/*if not in tmp hash table...*/
		if (!LHash_IsInTable (theTmpHashTable, (ui4)*theTreePtr))
		{
			/*insert in tmp hash table...*/
			LHash_InsertItem (theTmpHashTable, NULL, (ui4)*theTreePtr);
			/*take size into account...*/
			theLArraysUsedMem=theLArraysUsedMem + LArray_GetUsedMem(*theTreePtr);
		}	
	}
	
	/*deletes tmp hash table...*/
	LHash_Delete (&theTmpHashTable);
	
	/*must be manually deleted...*/
	LArray_Delete (&theItems);
		
	return (theHashTableUsedMem + theQuickFindStructUsedMem + theLArraysUsedMem);
}
Ejemplo n.º 2
0
/* ---------------------------------------------------------------------------------
*  GetUsedMem
*  ---------------------------------------------------------------------------------
*  Returns the total memory usage */
ui4 LEdgeInfo_GetUsedMem(LEdgeInfo* This)
{
	if (This == NULL) Throw(LEdgeInfo_OBJECT_NULL_POINTER);
	return (sizeof(LEdgeInfo) + LArray_GetUsedMem(This->mData));
}