Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 224 for Malloc (0.14 sec)

  1. src/cmd/cgo/out.go

    const char *_cgoPREFIX_Cfunc_CString(struct __go_string s) {
    	char *p = malloc(s.__length+1);
    	if(p == NULL)
    		runtime_throw("runtime: C malloc failed");
    	memmove(p, s.__data, s.__length);
    	p[s.__length] = 0;
    	return p;
    }
    
    void *_cgoPREFIX_Cfunc_CBytes(struct __go_open_array b) {
    	char *p = malloc(b.__count);
    	if(p == NULL)
    		runtime_throw("runtime: C malloc failed");
    	memmove(p, b.__values, b.__count);
    	return p;
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Mar 29 16:41:10 UTC 2024
    - 59.6K bytes
    - Viewed (0)
  2. src/cmd/cgo/internal/testsanitizers/testdata/tsan15.go

    static void *sendthr(void *arg) {
    	pthread_t th = *(pthread_t*)arg;
    	while (1) {
    		int r = pthread_kill(th, SIGWINCH);
    		if (r < 0)
    			break;
    	}
    	return 0;
    }
    
    static void foo() {
    	pthread_t *th = malloc(sizeof(pthread_t));
    	pthread_t th2;
    	pthread_create(th, 0, thr, 0);
    	pthread_create(&th2, 0, sendthr, th);
    	pthread_join(*th, 0);
    }
    */
    import "C"
    
    import (
    	"time"
    )
    
    //export go_callback
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 06 21:14:49 UTC 2024
    - 968 bytes
    - Viewed (0)
  3. src/runtime/os_aix.go

    }
    
    //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 mallocgc
    	// here because it could cause a deadlock.
    	sem = (*semt)(malloc(unsafe.Sizeof(*sem)))
    	if sem_init(sem, 0, 0) != 0 {
    		throw("sem_init")
    	}
    	mp.waitsema = uintptr(unsafe.Pointer(sem))
    }
    
    //go:nosplit
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 25 19:53:03 UTC 2024
    - 8.9K bytes
    - Viewed (0)
  4. 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)
  5. 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)
  6. 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)
  7. src/internal/trace/testdata/testprog/stress-start-stop.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() {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 17 18:48:18 UTC 2024
    - 2.7K bytes
    - Viewed (0)
  8. tensorflow/compiler/mlir/lite/utils/string_utils.cc

      int32_t bytes = data_.size()                            // size of content
                      + sizeof(int32_t) * (num_strings + 2);  // size of header
      // Caller will take ownership of buffer.
      *buffer = reinterpret_cast<char*>(malloc(bytes));
    
      if (*buffer == nullptr) {
        return -1;
      }
    
      // Set num of string
      //
      // NOTE: The string buffer is accessed here as if it's native endian (instead
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Wed Jun 12 21:41:49 UTC 2024
    - 2.9K bytes
    - Viewed (0)
  9. tensorflow/c/c_test.c

      }
    
      char file_name[100];
      time_t t = time(NULL);
      snprintf(file_name, sizeof(file_name), "test-%d-%ld.txt", getpid(), t);
    
      size_t length = 2 + strlen(path) + strlen(file_name);
      char* full_path = malloc(length);
      snprintf(full_path, length, "%s/%s", path, file_name);
    
      TF_WritableFileHandle* h;
      TF_Status* status = TF_NewStatus();
      TF_NewWritableFile(full_path, &h, status);
      if (TF_GetCode(status) != TF_OK) {
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Wed Apr 24 20:50:35 UTC 2024
    - 2.8K bytes
    - Viewed (0)
  10. src/cmd/cgo/internal/test/test.go

    	// nothing to run, just make sure this compiles.
    	_ = C.X
    }
    
    // issue 6390
    
    func test6390(t *testing.T) {
    	p1 := C.malloc(1024)
    	if p1 == nil {
    		t.Fatalf("C.malloc(1024) returned nil")
    	}
    	p2 := C.malloc(0)
    	if p2 == nil {
    		t.Fatalf("C.malloc(0) returned nil")
    	}
    	C.free(p1)
    	C.free(p2)
    }
    
    func test6472() {
    	// nothing to run, just make sure this compiles
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 20 15:50:06 UTC 2024
    - 48.5K bytes
    - Viewed (0)
Back to top