2010-12-03 05:34:57 +01:00
|
|
|
/* go-new.c -- the generic go new() function.
|
|
|
|
|
|
|
|
Copyright 2009 The Go Authors. All rights reserved.
|
|
|
|
Use of this source code is governed by a BSD-style
|
|
|
|
license that can be found in the LICENSE file. */
|
|
|
|
|
|
|
|
#include "go-alloc.h"
|
|
|
|
#include "runtime.h"
|
|
|
|
#include "malloc.h"
|
|
|
|
|
|
|
|
void *
|
2011-04-13 23:00:59 +02:00
|
|
|
__go_new (uintptr_t size)
|
2010-12-03 05:34:57 +01:00
|
|
|
{
|
2011-03-07 23:19:50 +01:00
|
|
|
return runtime_mallocgc (size, 0, 1, 1);
|
2010-12-03 05:34:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void *
|
2011-04-13 23:00:59 +02:00
|
|
|
__go_new_nopointers (uintptr_t size)
|
2010-12-03 05:34:57 +01:00
|
|
|
{
|
2011-03-17 00:05:44 +01:00
|
|
|
return runtime_mallocgc (size, FlagNoPointers, 1, 1);
|
2010-12-03 05:34:57 +01:00
|
|
|
}
|