We got nominated! Help us out and vote for GitHub as Best Bootstrapped Startup of 2008. (You can vote once a day.) [ hide ]

public
Description: 10gen database
Homepage: http://www.10gen.com/wiki/db
Clone URL: git://github.com/10gen/mongo.git
check for out of memory
Dwight (author)
Thu Jul 17 10:42:20 -0700 2008
commit  c3adb4946fd99ff8a76fc1abb0fabbbae2254c80
tree    b7f211968e9f216eb5a984bb492c76ef5f7bcc1a
parent  2612fa547b8c7a83d96d252e2db4cc36f93b7fd8
...
930
931
932
933
934
 
 
935
936
937
...
930
931
932
 
 
933
934
935
936
937
0
@@ -930,8 +930,8 @@ int main(int argc, char* argv[], char *envp[] )
0
 //#endif
0
 
0
 #undef exit
0
-void dbexit(int rc) {
0
- cout << " dbexit: flushing op log and files" << endl;
0
+void dbexit(int rc, const char *why) {
0
+ cout << " dbexit: " << why << "; flushing op log and files" << endl;
0
   flushOpLog();
0
 
0
   /* must do this before unmapping mem or you may get a seg fault */
...
11
12
13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
15
16
...
126
127
128
129
130
131
132
...
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
...
145
146
147
 
148
149
150
0
@@ -11,6 +11,25 @@ const bool debug=true;
0
 const bool debug=false;
0
 #endif
0
 
0
+#include <memory>
0
+
0
+extern void dbexit(int returnCode, const char *whyMsg = "");
0
+
0
+inline void * ourmalloc(size_t size) {
0
+ void *x = malloc(size);
0
+ if( x == 0 ) dbexit(42, "malloc fails");
0
+ return x;
0
+}
0
+
0
+inline void * ourrealloc(void *ptr, size_t size) {
0
+ void *x = realloc(ptr, size);
0
+ if( x == 0 ) dbexit(43, "realloc fails");
0
+ return x;
0
+}
0
+
0
+#define malloc ourmalloc
0
+#define realloc ourrealloc
0
+
0
 #include "targetver.h"
0
 
0
 //#include "assert.h"
0
@@ -126,7 +145,6 @@ inline void our_debug_free(void *p) {
0
 #define free our_debug_free
0
 #endif
0
 
0
-void dbexit(int resultcode);
0
 #define exit dbexit
0
 
0
 #undef yassert
...
53
54
55
56
...
53
54
55
 
0
@@ -53,4 +53,3 @@ extern Logstream logstream;
0
 inline Logstream& problem() { return logstream.prolog(); }
0
 
0
 #define cout logstream
0
-

Comments

    No one has commented yet.