Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Aug 1999 13:57:16 -0600
From:      Charles Randall <crandall@matchlogic.com>
To:        Charlie ROOT <root@sani-c.vrn.ru>, freebsd-questions@FreeBSD.ORG
Subject:   RE: System hang when mmap() large files
Message-ID:  <64003B21ECCAD11185C500805F31EC0303786B0B@houston.matchlogic.com>

next in thread | raw e-mail | index | archive | help
From: Charles Randall [mailto:crandall@matchlogic.com]
>Are you running the machine out of swap? Looks like you
>mmap 10 new MB on each iteration. What happens if you munmap()
>the region before the close()?

I didn't phrase that very well.

Is this what you intended or were you trying to point out a problem with
FreeBSD's mmap()?

Charles

--- mmap.c.orig Tue Aug 10 13:54:40 1999
+++ mmap.c      Tue Aug 10 13:55:13 1999
@@ -1,3 +1,5 @@
+#include <stdio.h>
+#include <stdlib.h>
 #include <sys/types.h>
 #include <sys/mman.h>
 #include <unistd.h>
@@ -29,7 +31,11 @@
        printf("mmap error %ld",errno);
        exit(1);
     }
-    close(fd);
     memset(addr,'x',len);
+    if ( munmap(addr, len) != 0 ) {
+      fprintf(stderr, "munmap failed\n");
+      exit(EXIT_FAILURE);
+    }
+    close(fd);
     }
 }


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?64003B21ECCAD11185C500805F31EC0303786B0B>