Search Options

Results per page
Sort
Preferred Languages
Advance

Results 41 - 50 of 417 for Malloc (0.17 sec)

  1. src/net/cgo_unix_cgo.go

    	_C_uint            = C.uint
    	_C_socklen_t       = C.socklen_t
    	_C_struct_addrinfo = C.struct_addrinfo
    	_C_struct_sockaddr = C.struct_sockaddr
    )
    
    func _C_malloc(n uintptr) unsafe.Pointer { return C.malloc(C.size_t(n)) }
    func _C_free(p unsafe.Pointer)           { C.free(p) }
    
    func _C_ai_addr(ai *_C_struct_addrinfo) **_C_struct_sockaddr { return &ai.ai_addr }
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Mar 15 17:49:28 UTC 2024
    - 2.2K bytes
    - Viewed (0)
  2. src/runtime/os3_solaris.go

    	return true
    }
    
    //go:nosplit
    func semacreate(mp *m) {
    	if mp.waitsema != 0 {
    		return
    	}
    
    	var sem *semt
    
    	// Call libc's malloc rather than malloc. This will
    	// allocate space on the C heap. We can't call malloc
    	// here because it could cause a deadlock.
    	mp.libcall.fn = uintptr(unsafe.Pointer(&libc_malloc))
    	mp.libcall.n = 1
    	mp.scratch = mscratch{}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 25 19:53:03 UTC 2024
    - 17.6K bytes
    - Viewed (0)
  3. src/cmd/cgo/internal/testsanitizers/testdata/tsan9.go

    #include <stdlib.h>
    #include <sys/time.h>
    
    void spin() {
    	size_t n;
    	struct timeval tvstart, tvnow;
    	int diff;
    	void *prev = NULL, *cur;
    
    	gettimeofday(&tvstart, NULL);
    	for (n = 0; n < 1<<20; n++) {
    		cur = malloc(n);
    		free(prev);
    		prev = cur;
    
    		gettimeofday(&tvnow, NULL);
    		diff = (tvnow.tv_sec - tvstart.tv_sec) * 1000 * 1000 + (tvnow.tv_usec - tvstart.tv_usec);
    
    		// Profile frequency is 100Hz so we should definitely
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 12 11:59:56 UTC 2023
    - 1.3K bytes
    - Viewed (0)
  4. src/cmd/cgo/internal/testsanitizers/testdata/msan6.go

    #cgo LDFLAGS: -fsanitize=memory
    #cgo CPPFLAGS: -fsanitize=memory
    
    #include <stdint.h>
    #include <stdlib.h>
    #include <string.h>
    
    typedef struct {
    	uintptr_t a[20];
    } S;
    
    S f() {
    	S *p;
    
    	p = (S *)(malloc(sizeof(S)));
    	p->a[0] = 0;
    	return *p;
    }
    */
    import "C"
    
    // allocateStack extends the stack so that stack copying doesn't
    // confuse the msan data structures.
    //
    //go:noinline
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 12 11:59:56 UTC 2023
    - 1.4K bytes
    - Viewed (0)
  5. src/encoding/gob/timing_test.go

    		}
    	})
    	if allocs != 0 {
    		t.Fatalf("mallocs per encode of type Bench: %v; wanted 0\n", allocs)
    	}
    }
    
    func TestCountDecodeMallocs(t *testing.T) {
    	if testing.Short() {
    		t.Skip("skipping malloc count in short mode")
    	}
    	if runtime.GOMAXPROCS(0) > 1 {
    		t.Skip("skipping; GOMAXPROCS>1")
    	}
    
    	const N = 1000
    
    	var buf bytes.Buffer
    	enc := NewEncoder(&buf)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 04 07:16:59 UTC 2023
    - 6.5K bytes
    - Viewed (0)
  6. test/fixedbugs/issue47185.dir/bad/bad.go

    		len(a.B.C1.D2.E2.F7) != 0 ||
    		len(a.B.C1.D2.E2.F8) != 0 ||
    		len(a.B.C1.D2.E2.F9) != 0 ||
    		len(a.B.C1.D2.E2.F10) != 0 ||
    		len(a.B.C1.D2.E2.F11) != 0 ||
    		len(a.B.C1.D2.E2.F16) != 0 {
    		panic("bad")
    	}
    	C.malloc(100)
    }
    
    type A struct {
    	B
    }
    
    type B struct {
    	C1 C
    	C2 C
    }
    
    type C struct {
    	D1 D
    	D2 D
    }
    
    type D struct {
    	E1 E
    	E2 E
    	E3 E
    	E4 E
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jul 19 13:27:46 UTC 2021
    - 1.1K bytes
    - Viewed (0)
  7. src/internal/trace/testdata/testprog/stress.go

    	go func() {
    		runtime.LockOSThread()
    		for {
    			select {
    			case <-done:
    				return
    			default:
    				runtime.Gosched()
    			}
    		}
    	}()
    
    	runtime.GC()
    	// Trigger GC from malloc.
    	n := 512
    	for i := 0; i < n; i++ {
    		_ = make([]byte, 1<<20)
    	}
    
    	// Create a bunch of busy goroutines to load all Ps.
    	for p := 0; p < 10; p++ {
    		wg.Add(1)
    		go func() {
    			// Do something useful.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 17 18:48:18 UTC 2024
    - 2.5K bytes
    - Viewed (0)
  8. src/cmd/vendor/golang.org/x/tools/go/analysis/passes/cgocall/cgocall.go

    // such as this one:
    //
    //	package p
    //	import "C"
    //	import "fmt"
    //	type T int
    //	const k = 3
    //	var x, y = fmt.Println()
    //	func f() { ... }
    //	func g() { ... C.malloc(k) ... }
    //	func (T) f(int) string { ... }
    //
    // we synthesize a new ast.File, shown below, that dot-imports the
    // original "cooked" package using a special name ("·this·"), so that all
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 23:33:33 UTC 2023
    - 11.2K bytes
    - Viewed (0)
  9. src/cmd/cgo/internal/testerrors/testdata/err2.go

    typedef void v;
    void F(v** p) {}
    
    void fvi(void *p, int x) {}
    
    void fppi(int** p) {}
    
    int i;
    void fi(int i) {}
    */
    import "C"
    import (
    	"unsafe"
    )
    
    func main() {
    	s := ""
    	_ = s
    	C.malloc(s) // ERROR HERE
    
    	x := (*C.bar_t)(nil)
    	C.foop = x // ERROR HERE
    
    	// issue 13129: used to output error about C.unsignedshort with CC=clang
    	var x1 C.ushort
    	x1 = int(0) // ERROR HERE: C\.ushort
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 12 11:59:56 UTC 2023
    - 2.5K bytes
    - Viewed (0)
  10. src/strconv/strconv_test.go

    		Buffer: make([]byte, 1024),
    	}
    
    	checkNoAllocs := func(f func()) func(t *testing.T) {
    		return func(t *testing.T) {
    			t.Helper()
    			if allocs := testing.AllocsPerRun(runsPerTest, f); allocs != 0 {
    				t.Errorf("got %v allocs, want 0 allocs", allocs)
    			}
    		}
    	}
    
    	t.Run("Atoi", checkNoAllocs(func() {
    		Sink.Int, Sink.Error = Atoi(string(bytes.Number))
    	}))
    	t.Run("ParseBool", checkNoAllocs(func() {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Aug 23 20:29:22 UTC 2022
    - 4.7K bytes
    - Viewed (0)
Back to top