Example #1
0
void destroyReminder()
{
	if(reminder != NULL)
		trackFree(reminder);
	
	reminder = NULL;
}
Example #2
0
void editReminderAction(char c)
{
	if(c == 0) return;
	
	setPressedChar(c);
	
	if(c == CLEAR_KEY)
	{
		memset(reminder, 0, REM_SIZE);
		resetKBCursor();
		return;
	}
	if(c == CAP)
	{
		toggleCaps();
		return;
	}
	
	char *tmpBuffer = (char *)trackMalloc(REM_SIZE,"reminder kbd");
	memcpy(tmpBuffer,reminder,REM_SIZE);
	int oldCursor = getKBCursor();
	
	genericAction(tmpBuffer, REM_SIZE - 1, c);
	
	int *pts = NULL;
	int numPts = getWrapPoints(0, -3, tmpBuffer, 3, 41, 252, 190, &pts, font_arial_9);
	free(pts);
	
	if(numPts <= MAX_LINES_REMINDER)
		memcpy(reminder,tmpBuffer,REM_SIZE);
	else
		moveKBCursorAbsolute(oldCursor);
	
	trackFree(tmpBuffer);
}
Example #3
0
// Memory routines
void destroyDay()
{
	if(dayView != NULL)
		trackFree(dayView);
	
	dayView = NULL;
}
void Streckenblock::mainSensorFree() { 
    DEBUG(id); 
	DEBUG(": MainSensor Free\n");
	if (isFree()) {
		trackFree();
	};
}
Example #5
0
void destroySideTabs()
{
	if(sideTabs)
	{
		for(int i=0;i<numTabs;i++)
		{
			if(sideTabs[i].icon)
				trackFree(sideTabs[i].icon);
			
			sideTabs[i].icon = NULL;
		}
		
		trackFree(sideTabs);
	}
	
	sideTabs = NULL;
	numTabs = 0;
}
Example #6
0
	void Fragmento::pageFree(Page* page)
	{ 
		//fprintf(stderr, "Fragmento::pageFree %X,  %d free pages of %d\n", (int)page, _stats.freePages+1, _stats.pages);

		// link in the page
		page->next = _pageList;
		_pageList = page;
		trackFree(+1);
		NanoAssert(pageCount()==_stats.freePages);
	}
Example #7
0
void destroyRandomList()
{
	if(history != NULL)
	{
		setGlobalError(ERROR_SOUND_FREEPLAYLIST);
		trackFree(history);
		setGlobalError(ERROR_NONE);
	}
	
	history = NULL;
}
Example #8
0
	void Fragmento::pagesGrow(int32_t count)
	{
		NanoAssert(!_pageList);
		MMGC_MEM_TYPE("NanojitFragmentoMem"); 
		Page* memory = 0;
		if (_stats.pages < _max_pages)
		{
            // make sure we don't grow beyond _max_pages
            if (_stats.pages + count > _max_pages)
                count = _max_pages - _stats.pages;
            if (count < 0)
                count = 0;
			// @todo nastiness that needs a fix'n
			_gcHeap = _core->GetGC()->GetGCHeap();
			NanoAssert(int32_t(NJ_PAGE_SIZE)<=_gcHeap->kNativePageSize);
			
			// convert _max_pages to gc page count 
			int32_t gcpages = (count*NJ_PAGE_SIZE) / _gcHeap->kNativePageSize;
			MMGC_MEM_TYPE("NanoJitMem"); 
			memory = (Page*)_gcHeap->Alloc(gcpages);
#ifdef MEMORY_INFO
			ChangeSizeExplicit("NanoJitMem", 1, _gcHeap->Size(memory));
#endif
			NanoAssert((int*)memory == pageTop(memory));
			//fprintf(stderr,"head alloc of %d at %x of %d pages using nj page size of %d\n", gcpages, (intptr_t)memory, (intptr_t)_gcHeap->kNativePageSize, NJ_PAGE_SIZE);

            _allocList.add(memory);

			Page* page = memory;
			_pageList = page;
			_stats.pages += count;
			_stats.freePages += count;
			trackFree(0);
			while(--count > 0)
			{
				Page *next = page + 1;
				//fprintf(stderr,"Fragmento::pageGrow adding page %x ; %d\n", (intptr_t)page, count);
				page->next = next;
				page = next; 
			}
			page->next = 0;
			NanoAssert(pageCount()==_stats.freePages);
			//fprintf(stderr,"Fragmento::pageGrow adding page %x ; %d\n", (intptr_t)page, count);
		}
	}
Example #9
0
	Page* Fragmento::pageAlloc()
	{
        NanoAssert(sizeof(Page) == NJ_PAGE_SIZE);
		if (!_pageList) {
			pagesGrow(_pageGrowth);	// try to get more mem
            if ((_pageGrowth << 1) < _max_pages)
                _pageGrowth <<= 1;
        }
		Page *page = _pageList;
		if (page)
		{
			_pageList = page->next;
			trackFree(-1);
		}
		//fprintf(stderr, "Fragmento::pageAlloc %X,  %d free pages of %d\n", (int)page, _stats.freePages, _stats.pages);
		NanoAssert(pageCount()==_stats.freePages);
		return page;
	}