Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 490 for malloc (0.4 sec)

  1. src/cmd/cgo/internal/test/issue23555b/a.go

    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    package issue23555
    
    // #include <stdlib.h>
    import "C"
    
    func X() {
    	C.free(C.malloc(10))
    Go
    - Registered: Tue Apr 23 11:13:09 GMT 2024
    - Last Modified: Fri May 12 12:00:02 GMT 2023
    - 250 bytes
    - Viewed (0)
  2. src/cmd/cgo/internal/swig/testdata/stdio/main.swig

    /* A trivial example of wrapping a C library using SWIG.  */
    
    %{
    #include <stdio.h>
    #include <stdlib.h>
    %}
    
    %typemap(gotype) const char * "string"
    %typemap(in) const char * %{
    	$1 = malloc($input.n + 1);
    	memcpy($1, $input.p, $input.n);
    	$1[$input.n] = '\0';
    %}
    %typemap(freearg) const char * %{
    	free($1);
    %}
    
    FILE *fopen(const char *name, const char *mode);
    int fclose(FILE *);
    Plain Text
    - Registered: Tue Apr 23 11:13:09 GMT 2024
    - Last Modified: Fri May 12 12:00:07 GMT 2023
    - 563 bytes
    - Viewed (0)
  3. src/cmd/cgo/internal/test/issue23555a/a.go

    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    package issue23555
    
    // #include <stdlib.h>
    import "C"
    
    func X() {
    	C.free(C.malloc(10))
    Go
    - Registered: Tue Apr 23 11:13:09 GMT 2024
    - Last Modified: Fri May 12 12:00:02 GMT 2023
    - 250 bytes
    - Viewed (0)
  4. tensorflow/c/eager/c_api_experimental.cc

    }
    
    const void TFE_MonitoringStringGaugeCellValue(
        TFE_MonitoringStringGaugeCell* cell, TF_Buffer* buf) {
      tensorflow::string value = cell->cell.value();
      void* data = tensorflow::port::Malloc(value.length());
      value.copy(static_cast<char*>(data), value.length(), 0);
      buf->data = data;
      buf->length = value.length();
      buf->data_deallocator = [](void* data, size_t length) {
        tensorflow::port::Free(data);
    C++
    - Registered: Tue Apr 23 12:39:09 GMT 2024
    - Last Modified: Thu Apr 11 23:52:39 GMT 2024
    - 35.9K bytes
    - Viewed (3)
  5. 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) {
    C
    - Registered: Tue Apr 23 12:39:09 GMT 2024
    - Last Modified: Wed Jan 15 17:51:26 GMT 2020
    - 2.8K bytes
    - Viewed (0)
  6. src/cmd/cgo/doc.go

    	func C.GoBytes(unsafe.Pointer, C.int) []byte
    
    As a special case, C.malloc does not call the C library malloc directly
    but instead calls a Go helper function that wraps the C library malloc
    but guarantees never to return nil. If C's malloc indicates out of memory,
    the helper function crashes the program, like when Go itself runs out
    of memory. Because C.malloc cannot fail, it has no two-result form
    that returns errno.
    
    Go
    - Registered: Tue Apr 23 11:13:09 GMT 2024
    - Last Modified: Sun Mar 31 09:02:45 GMT 2024
    - 42.1K bytes
    - Viewed (0)
  7. src/cmd/cgo/ast.go

    	if goname == "errno" {
    		error_(sel.Pos(), "cannot refer to errno directly; see documentation")
    		return
    	}
    	if goname == "_CMalloc" {
    		error_(sel.Pos(), "cannot refer to C._CMalloc; use C.malloc")
    		return
    	}
    	if goname == "malloc" {
    		goname = "_CMalloc"
    	}
    	name := f.Name[goname]
    	if name == nil {
    		name = &Name{
    			Go: goname,
    		}
    		f.Name[goname] = name
    Go
    - Registered: Tue Apr 23 11:13:09 GMT 2024
    - Last Modified: Wed Jun 07 16:54:27 GMT 2023
    - 14.3K bytes
    - Viewed (0)
  8. tensorflow/c/c_api_experimental.cc

      *len = debug_str.size();
      char* ret = static_cast<char*>(malloc(*len + 1));
      memcpy(ret, debug_str.c_str(), *len + 1);
      return ret;
    }
    
    char* TF_FunctionDebugString(TF_Function* func, size_t* len) {
      const auto& debug_str = DebugString(func->record->fdef());
      *len = debug_str.size();
      char* ret = static_cast<char*>(malloc(*len + 1));
      memcpy(ret, debug_str.c_str(), *len + 1);
      return ret;
    }
    
    C++
    - Registered: Tue Apr 23 12:39:09 GMT 2024
    - Last Modified: Mon Apr 15 03:35:10 GMT 2024
    - 29.4K bytes
    - Viewed (0)
  9. tensorflow/c/experimental/next_pluggable_device/c_api.cc

      if (!value.ok()) {
        return nullptr;
      }
      // Caller is responsible to call `TF_DeleteBuffer` to release the buffer.
      TF_Buffer* result = TF_NewBuffer();
      const std::string& value_str = *value;
      void* data = malloc(value_str.length());
      value_str.copy(static_cast<char*>(data), value_str.length(), 0);
      result->data = data;
      result->length = value_str.length();
      result->data_deallocator = [](void* data, size_t length) { free(data); };
    C++
    - Registered: Tue Feb 27 12:39:08 GMT 2024
    - Last Modified: Tue Jan 09 00:52:04 GMT 2024
    - 13.9K bytes
    - Viewed (1)
  10. src/cmd/cgo/gcc.go

    				}
    				break
    			}
    			error_(r.Pos(), "call of non-function C.%s", fixGo(r.Name.Go))
    			break
    		}
    		if r.Context == ctxCall2 {
    			if r.Name.Go == "_CMalloc" {
    				error_(r.Pos(), "no two-result form for C.malloc")
    				break
    			}
    			// Invent new Name for the two-result function.
    			n := f.Name["2"+r.Name.Go]
    			if n == nil {
    				n = new(Name)
    				*n = *r.Name
    Go
    - Registered: Tue Apr 23 11:13:09 GMT 2024
    - Last Modified: Thu Nov 02 16:43:23 GMT 2023
    - 97K bytes
    - Viewed (0)
Back to top