Пример #1
0
void _collectIfNeeded(size_t bytes) {
    if (bytesAllocatedSinceCollection >= ALLOCBYTES_PER_COLLECTION) {
        bytesAllocatedSinceCollection = 0;
        runCollection();
    }
    bytesAllocatedSinceCollection += bytes;
}
Пример #2
0
void _bytesAllocatedTripped() {
    gc_registered_bytes.log(bytesAllocatedSinceCollection);
    bytesAllocatedSinceCollection = 0;

    if (!gcIsEnabled())
        return;

    threading::GLPromoteRegion _lock;
    runCollection();
}
Пример #3
0
void registerGCManagedBytes(size_t bytes) {
    thread_bytesAllocatedSinceCollection += bytes;
    if (unlikely(thread_bytesAllocatedSinceCollection > ALLOCBYTES_PER_COLLECTION / 4)) {
        bytesAllocatedSinceCollection += thread_bytesAllocatedSinceCollection;
        thread_bytesAllocatedSinceCollection = 0;

        if (bytesAllocatedSinceCollection >= ALLOCBYTES_PER_COLLECTION) {
            if (!gcIsEnabled())
                return;

            // bytesAllocatedSinceCollection = 0;
            // threading::GLPromoteRegion _lock;
            // runCollection();

            threading::GLPromoteRegion _lock;
            if (bytesAllocatedSinceCollection >= ALLOCBYTES_PER_COLLECTION) {
                runCollection();
                bytesAllocatedSinceCollection = 0;
            }
        }
    }
}