Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Feb 2000 16:25:33 -0600 (CST)
From:      Kevin Day <toasty@dragondata.com>
To:        hackers@freebsd.org
Subject:   Off by one error in ulimit?
Message-ID:  <200002142225.QAA00274@celery.dragondata.com>

next in thread | raw e-mail | index | archive | help

I don't have access to a -current machine to try this on, so this only
applies to 3.4.

I have my ulimit set to 8MB for data/etc:

 ulimit -a
core file size (blocks)     8192
data seg size (kbytes)      8192
file size (blocks)          8192
max locked memory (kbytes)  4096
max memory size (kbytes)    8192
open files                  24
pipe size (512 bytes)       1
stack size (kbytes)         2048
cpu time (seconds)          5400
max user processes          32
virtual memory (kbytes)     8192


I have a program that starts to attempt mallocing 8MB, and decreasing the
malloc size by 1 byte every time malloc fails. I end up with a value somewhere
between 7 and 8MB when malloc succeeds, which is fine.

However, when I actually use this malloc'ed region, I segv when I touch the
very last page. Can anyone explain this? :)

As long as my malloc doesn't bump into the ulimit, everything works fine.
Either malloc() doesn't take into account a fencepost situation somewhere,
or I'm losing my mind. :)

Kevin


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




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