Git Product home page Git Product logo

Comments (2)

bnoordhuis avatar bnoordhuis commented on June 15, 2024

I can guess the context in which you're opening this issue. saghul/txiki.js#457, right? :)

The extra allocation could be avoided like this:

diff --git a/src/unix/fs.c b/src/unix/fs.c
index 3a74350f..99d42d4e 100644
--- a/src/unix/fs.c
+++ b/src/unix/fs.c
@@ -2127,6 +2127,13 @@ void uv_fs_req_cleanup(uv_fs_t* req) {
     uv__free(req->bufs);
   req->bufs = NULL;
 
+#if defined(_POSIX_VERSION) && _POSIX_VERSION >= 200809L
+  if (req->fs_type == UV_FS_REALPATH) {
+    free(req->ptr);  /* _Not_ uv__free() */
+    req->ptr = NULL;
+  }
+#endif
+
   if (req->fs_type != UV_FS_OPENDIR && req->ptr != &req->statbuf)
     uv__free(req->ptr);
   req->ptr = NULL;

from libuv.

saghul avatar saghul commented on June 15, 2024

I can guess the context in which you're opening this issue. saghul/txiki.js#457, right? :)

Pretty much :-)

The extra allocation could be avoided like this:

Not quite. We have other uses of realpath. The one that hit me first was:

handle->realpath = realpath(handle->path, NULL);

Which can also be fixed in a similar way.

After sleeping on it it's probably ok to just go through and fix the specific instances of this problem. Having a few small allocations on the system allocator is not too bad...

from libuv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.