void loopMain() {
    refreshWatchdog();
    unsigned long startMicros = micros();

    updateAccelerometer();

    // display lights
    lights->reset();
    controller->paint(*lights);
    capOverallBrightness(*lights);
    lights->show();
    
    
    unsigned long endMicros = micros();
    avgTime = (15*avgTime + endMicros - startMicros)/16;
    
    int timeToDelay = (int)(10 - (endMicros - startMicros)/1000);
    if (timeToDelay > 0)
        delay(timeToDelay);
    int blink = (millis() /100)%2;
    digitalWrite(ONBOARD_LED_PIN, blink);
    if (count++ >= 100) {
        
        // Print head size for debugging.
#ifdef RN_PRINT_HEAP_SIZE
        info->printf("Avg time = %5d, delay = %dms, heapSize = %d\n",
                     avgTime, timeToDelay, heapSize());
        count = 0;
#endif /* RN_PRINT_HEAP_SIZE */
        
    }
    // Serial.println(millis()/10);
}
Ejemplo n.º 2
0
int main () {

    initHeap();

    List * list = nil();
    int i, j;
    for (i = 0; i < 5; i++) {
        List * inner = nil();
        for (j = 0; j < 5; j++)
        {
            Position * p = alloc(sizeof(Position), NULL, NULL);
            inner = cons((void *)p, inner);
        }
        list = cons((void *)inner, list);
    }

    printHeap(HEAP);
    printf("%d\n", heapSize(HEAP));


    release((void *)list);

    printf("========\n");
    printHeap(HEAP);

    return 0;
}
Ejemplo n.º 3
0
void APCLocalArray::Release(ArrayData* ad) {
  assert(ad->hasExactlyOneRef());
  auto const a = asApcArray(ad);
  auto size = a->heapSize();

  for (auto tv = a->localCache(), end = tv + a->m_size; tv < end; ++tv) {
    tvDecRefGen(tv);
  }
  a->m_arr->unreference();
  MM().removeApcArray(a);
  MM().objFree(a, size);
}
Ejemplo n.º 4
0
void delete_AwaitAllWaitHandle(ObjectData* od, const Class*) {
  auto const waitHandle = static_cast<c_AwaitAllWaitHandle*>(od);
  auto bytes = waitHandle->heapSize();
  waitHandle->~c_AwaitAllWaitHandle();
  MM().objFree(waitHandle, bytes);
}
Ejemplo n.º 5
0
void ResourceData::vscan(IMarker& mark) const {
  // default implementation scans for ambiguous pointers.
  mark(this, heapSize());
}
Ejemplo n.º 6
0
int
heapEmpty(HEAP heap)
{
    return heapSize(heap) == 0;
}
Ejemplo n.º 7
0
int TypePrimary::stackSize() {
    return heapSize();
}