Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
math/stp: remove nonsensical sbrk use
This code called sbrk(4000000) and beyond error checking ignored the result meaning the 4MB of address space allocated could never be used without another call to sbrk and reference to INITIAL_MEMORY_PREALLOCATION_SIZE, but nothing in the repo does either. Submitted upstream as stp/stp#474 Approved by: arrowd (maintainer) Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D42978
- Loading branch information
1 parent
6d4bc09
commit af6504f
Showing
2 changed files
with
46 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- tools/stp/main_common.cpp.orig | ||
+++ tools/stp/main_common.cpp | ||
@@ -27,16 +27,8 @@ | ||
#include "stp/Parser/parser.h" | ||
#include "stp/cpp_interface.h" | ||
|
||
-//for srbk() function | ||
-#if !defined(__MINGW32__) && !defined(__MINGW64__) && !defined(_MSC_VER) | ||
-#include <unistd.h> | ||
-#endif | ||
- | ||
extern void errorHandler(const char* error_msg); | ||
|
||
-// Amount of memory to ask for at beginning of main. | ||
-extern const intptr_t INITIAL_MEMORY_PREALLOCATION_SIZE; | ||
- | ||
using namespace stp; | ||
using std::unique_ptr; | ||
using std::cout; | ||
@@ -49,9 +41,6 @@ | ||
exit(-1); | ||
} | ||
|
||
-// Amount of memory to ask for at beginning of main. | ||
-const intptr_t INITIAL_MEMORY_PREALLOCATION_SIZE = 4000000; | ||
- | ||
Main::Main() : onePrintBack(false) | ||
{ | ||
bm = NULL; | ||
@@ -62,15 +51,6 @@ | ||
|
||
// Register the error handler | ||
vc_error_hdlr = errorHandler; | ||
- | ||
-#if !defined(__MINGW32__) && !defined(__MINGW64__) && !defined(_MSC_VER) | ||
- // Grab some memory from the OS upfront to reduce system time when | ||
- // individual hash tables are being allocated | ||
- if (sbrk(INITIAL_MEMORY_PREALLOCATION_SIZE) == ((void*)-1)) | ||
- { | ||
- FatalError("Initial allocation of memory failed."); | ||
- } | ||
-#endif | ||
|
||
bm = new STPMgr(); | ||
GlobalParserBM = bm; |