Files
swift-mirror/stdlib/runtime/Heap.cpp
Greg Parker fe8618a3d2 Scrap the custom allocator until we have time to fix it.
The allocator's crimes include:
* It uses OS SPI that must not be used by non-OS apps.
* It does not play well with memory debugging tools like Instruments.
* It does not return memory to the OS in response to memory pressure.
* It is less tested than we would like because many configurations 
  inadvertently turn it off (such as running from Xcode).
* Its per-thread magazine implementation does not actually work.
* Its "try alloc" flag is incompletely implemented and never used.
* Its "zero fill" flag is unimplemented and inconsistently used.



Swift SVN r20757
2014-07-30 14:11:40 +00:00

35 lines
1.1 KiB
C++

//===--- Heap.cpp - Swift Language Heap Logic -----------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
//
// Implementations of the Swift heap
//
//===----------------------------------------------------------------------===//
#include "swift/Runtime/HeapObject.h"
#include "swift/Runtime/Heap.h"
#include "Private.h"
#include "Debug.h"
#include <stdlib.h>
using namespace swift;
void *swift::swift_slowAlloc(size_t size, size_t alignMask) {
// FIXME: use posix_memalign if alignMask is larger than the system guarantee.
void *p = malloc(size);
if (!p) swift::crash("Could not allocate memory.");
return p;
}
void swift::swift_slowDealloc(void *ptr, size_t bytes, size_t alignMask) {
free(ptr);
}