Skip to content

Commit

Permalink
need to fix memory tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
billywhizz committed Oct 17, 2020
1 parent af7f9cf commit dfea948
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
11 changes: 8 additions & 3 deletions just.cc
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,11 @@ void just::sys::Spawn(const FunctionCallbackInfo<Value> &args) {
dup2(fds[0], 0);
dup2(fds[1], 1);
dup2(fds[2], 2);
chdir(*cwd);
int r = chdir(*cwd);
if (r < 0) {
fprintf(stderr, "error changing directory\n");
exit(127);
}
execvp(*filePath, argv);
perror("error launching child process");
for (int i = 0; i < len; i++) {
Expand Down Expand Up @@ -793,8 +797,9 @@ void just::sys::HeapSpaceUsage(const FunctionCallbackInfo<Value> &args) {
}

void just::sys::FreeMemory(void* buf, size_t length, void* data) {
free(buf);
free(data);
fprintf(stderr, "free memory %lu. figure this out.", length);
//free(buf);
//free(data);
}

void just::sys::Memcpy(const FunctionCallbackInfo<Value> &args) {
Expand Down
1 change: 1 addition & 0 deletions lib/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function writeString (fd, str) {
for (let i = 0, off = 0; i < chunks; ++i, off += 4096) {
const towrite = Math.min(len - off, 4096)
bytes = net.write(fd, buf, towrite, off)
// TODO: handle EAGAIN
if (bytes <= 0) break
total += bytes
}
Expand Down

0 comments on commit dfea948

Please sign in to comment.