#include "stdafx.h" #include #include #include #include #include #include #include "test.h" #include "boostheader.h" #include #include "io.h" using namespace boost::interprocess; namespace boostinter = boost::interprocess; using std::cout; using std::cin; using std::endl; void create_map(char* dbName); class SMTEST{ public: //so the allocator must allocate that pair. typedef int KeyType; typedef float MappedType; typedef std::pair ValueType; typedef allocator ShmemAllocator; typedef set, ShmemAllocator> MySet; managed_shared_memory *segment; MySet *mymap; SMTEST(char* dbName){ printf("dbName : %s\n",dbName); try{ segment = new managed_shared_memory(open_or_create,"MySharedMemory",8000000); ShmemAllocator alloc_inst (segment->get_segment_manager()); mymap = segment->find_or_construct(dbName)(std::less() ,alloc_inst); //second ctor parameter printf("shared_memory size(%d) : create %s\n", segment->get_free_memory(), dbName); } catch(boostinter::interprocess_exception &ex){ std::cout << ex.what() << std::endl; exit(1); } } }; #define CREATE(dbName) \ SMTEST *m_##dbName; \ m_##dbName = new SMTEST(#dbName) int _tmain(int argc, _TCHAR* argv[]){ printf("start!!\n"); CREATE(DB1); CREATE( DB2 ); CREATE( DB3 ); CREATE( DB4 ); CREATE( DB5 ); CREATE( DB6 ); CREATE( DB7 ); CREATE( DB8 ); CREATE( DB9 ); CREATE( DB10 ); CREATE( DB11 ); CREATE( DB12 ); CREATE( DB13 ); CREATE( DB14 ); CREATE( DB15 ); CREATE( DB16 ); CREATE( DB17 ); CREATE( DB18 ); CREATE( DB19 ); CREATE( DB20 ); CREATE( DB21 ); CREATE( DB22 ); CREATE( DB23 ); CREATE( DB24 ); CREATE( DB25 ); CREATE( DB26 ); CREATE( DB27 ); CREATE( DB28 ); CREATE( DB29 ); CREATE( DB30 ); CREATE( DB31 ); CREATE( DB32 ); CREATE( DB33 ); CREATE( DB34 ); CREATE( DB35 ); CREATE( DB36 ); CREATE( DB37 ); CREATE( DB38 ); CREATE( DB39 ); CREATE( DB40 ); CREATE( DB41 ); CREATE( DB42 ); CREATE( DB43 ); CREATE( DB44 ); CREATE( DB45 ); CREATE( DB46 ); CREATE( DB47 ); CREATE( DB48 ); CREATE( DB49 ); CREATE( DB50 ); CREATE( DB51 ); CREATE( DB52 ); CREATE( DB53 ); CREATE( DB54 ); CREATE( DB55 ); CREATE( DB56 ); CREATE( DB57 ); CREATE( DB58 ); CREATE( DB59 ); CREATE( DB60 ); CREATE( DB61 ); CREATE( DB62 ); CREATE( DB63 ); CREATE( DB64 ); CREATE( DB65 ); CREATE( DB66 ); CREATE( DB67 ); CREATE( DB68 ); CREATE( DB69 ); CREATE( DB70 ); CREATE( DB71 ); CREATE( DB72 ); CREATE( DB73 ); CREATE( DB74 ); CREATE( DB75 ); CREATE( DB76 ); CREATE( DB77 ); CREATE( DB78 ); CREATE( DB79 ); CREATE( DB80 ); CREATE( DB81 ); CREATE( DB82 ); CREATE( DB83 ); CREATE( DB84 ); CREATE( DB85 ); CREATE( DB86 ); CREATE( DB87 ); CREATE( DB88 ); CREATE( DB89 ); CREATE( DB90 ); CREATE( DB91 ); CREATE( DB92 ); CREATE( DB93 ); CREATE( DB94 ); CREATE( DB95 ); CREATE( DB96 ); CREATE( DB97 ); CREATE( DB98 ); CREATE( DB99 ); CREATE( DB100 ); CREATE( DB101 ); CREATE( DB102 ); CREATE( DB103 ); CREATE( DB104 ); CREATE( DB105 ); CREATE( DB106 ); CREATE( DB107 ); CREATE( DB108 ); CREATE( DB109 ); CREATE( DB110 ); CREATE( DB111 ); CREATE( DB112 ); CREATE( DB113 ); CREATE( DB114 ); CREATE( DB115 ); CREATE( DB116 ); CREATE( DB117 ); CREATE( DB118 ); CREATE( DB119 ); CREATE( DB120 ); CREATE( DB121 ); CREATE( DB122 ); CREATE( DB123 ); CREATE( DB124 ); CREATE( DB125 ); CREATE( DB126 ); CREATE( DB127 ); CREATE( DB128 ); CREATE( DB129 ); CREATE( DB130 ); CREATE( DB131 ); CREATE( DB132 ); CREATE( DB133 ); CREATE( DB134 ); CREATE( DB135 ); CREATE( DB136 ); CREATE( DB137 ); CREATE( DB138 ); CREATE( DB139 ); CREATE( DB140 ); CREATE( DB141 ); CREATE( DB142 ); CREATE( DB143 ); CREATE( DB144 ); CREATE( DB145 ); CREATE( DB146 ); CREATE( DB147 ); CREATE( DB148 ); CREATE( DB149 ); CREATE( DB150 ); CREATE( DB151 ); CREATE( DB152 ); CREATE( DB153 ); CREATE( DB154 ); CREATE( DB155 ); CREATE( DB156 ); CREATE( DB157 ); CREATE( DB158 ); CREATE( DB159 ); CREATE( DB160 ); CREATE( DB161 ); CREATE( DB162 ); CREATE( DB163 ); CREATE( DB164 ); CREATE( DB165 ); CREATE( DB166 ); CREATE( DB167 ); CREATE( DB168 ); CREATE( DB169 ); CREATE( DB170 ); CREATE( DB171 ); CREATE( DB172 ); CREATE( DB173 ); CREATE( DB174 ); CREATE( DB175 ); CREATE( DB176 ); CREATE( DB177 ); CREATE( DB178 ); CREATE( DB179 ); CREATE( DB180 ); CREATE( DB181 ); CREATE( DB182 ); CREATE( DB183 ); CREATE( DB184 ); CREATE( DB185 ); CREATE( DB186 ); CREATE( DB187 ); CREATE( DB188 ); CREATE( DB189 ); CREATE( DB190 ); CREATE( DB191 ); CREATE( DB192 ); CREATE( DB193 ); CREATE( DB194 ); CREATE( DB195 ); CREATE( DB196 ); CREATE( DB197 ); CREATE( DB198 ); CREATE( DB199 ); CREATE( DB200 ); CREATE( DB201 ); CREATE( DB202 ); CREATE( DB203 ); CREATE( DB204 ); CREATE( DB205 ); CREATE( DB206 ); CREATE( DB207 ); CREATE( DB208 ); CREATE( DB209 ); CREATE( DB210 ); CREATE( DB211 ); CREATE( DB212 ); CREATE( DB213 ); CREATE( DB214 ); CREATE( DB215 ); CREATE( DB216 ); CREATE( DB217 ); CREATE( DB218 ); CREATE( DB219 ); CREATE( DB220 ); CREATE( DB221 ); CREATE( DB222 ); CREATE( DB223 ); CREATE( DB224 ); CREATE( DB225 ); CREATE( DB226 ); CREATE( DB227 ); CREATE( DB228 ); CREATE( DB229 ); CREATE( DB230 ); CREATE( DB231 ); CREATE( DB232 ); CREATE( DB233 ); CREATE( DB234 ); CREATE( DB235 ); CREATE( DB236 ); CREATE( DB237 ); CREATE( DB238 ); CREATE( DB239 ); CREATE( DB240 ); CREATE( DB241 ); CREATE( DB242 ); CREATE( DB243 ); CREATE( DB244 ); CREATE( DB245 ); CREATE( DB246 ); CREATE( DB247 ); CREATE( DB248 ); CREATE( DB249 ); CREATE( DB250 ); CREATE( DB251 ); CREATE( DB252 ); CREATE( DB253 ); CREATE( DB254 ); CREATE( DB255 ); CREATE( DB256 ); CREATE( DB257 ); CREATE( DB258 ); CREATE( DB259 ); CREATE( DB260 ); CREATE( DB261 ); CREATE( DB262 ); CREATE( DB263 ); CREATE( DB264 ); CREATE( DB265 ); CREATE( DB266 ); CREATE( DB267 ); CREATE( DB268 ); CREATE( DB269 ); CREATE( DB270 ); CREATE( DB271 ); CREATE( DB272 ); CREATE( DB273 ); CREATE( DB274 ); CREATE( DB275 ); CREATE( DB276 ); CREATE( DB277 ); CREATE( DB278 ); CREATE( DB279 ); CREATE( DB280 ); CREATE( DB281 ); CREATE( DB282 ); CREATE( DB283 ); CREATE( DB284 ); CREATE( DB285 ); CREATE( DB286 ); CREATE( DB287 ); CREATE( DB288 ); CREATE( DB289 ); CREATE( DB290 ); CREATE( DB291 ); CREATE( DB292 ); CREATE( DB293 ); CREATE( DB294 ); CREATE( DB295 ); CREATE( DB296 ); CREATE( DB297 ); CREATE( DB298 ); CREATE( DB299 ); CREATE( DB300 ); CREATE( DB301 ); CREATE( DB302 ); CREATE( DB303 ); CREATE( DB304 ); CREATE( DB305 ); CREATE( DB306 ); CREATE( DB307 ); CREATE( DB308 ); CREATE( DB309 ); CREATE( DB310 ); CREATE( DB311 ); CREATE( DB312 ); CREATE( DB313 ); CREATE( DB314 ); CREATE( DB315 ); CREATE( DB316 ); CREATE( DB317 ); CREATE( DB318 ); CREATE( DB319 ); CREATE( DB320 ); CREATE( DB321 ); CREATE( DB322 ); CREATE( DB323 ); CREATE( DB324 ); CREATE( DB325 ); CREATE( DB326 ); CREATE( DB327 ); CREATE( DB328 ); CREATE( DB329 ); CREATE( DB330 ); CREATE( DB331 ); CREATE( DB332 ); CREATE( DB333 ); CREATE( DB334 ); CREATE( DB335 ); CREATE( DB336 ); CREATE( DB337 ); CREATE( DB338 ); CREATE( DB339 ); CREATE( DB340 ); CREATE( DB341 ); CREATE( DB342 ); CREATE( DB343 ); CREATE( DB344 ); CREATE( DB345 ); CREATE( DB346 ); CREATE( DB347 ); CREATE( DB348 ); CREATE( DB349 ); CREATE( DB350 ); CREATE( DB351 ); CREATE( DB352 ); CREATE( DB353 ); CREATE( DB354 ); CREATE( DB355 ); CREATE( DB356 ); CREATE( DB357 ); CREATE( DB358 ); CREATE( DB359 ); CREATE( DB360 ); CREATE( DB361 ); CREATE( DB362 ); CREATE( DB363 ); CREATE( DB364 ); CREATE( DB365 ); CREATE( DB366 ); CREATE( DB367 ); CREATE( DB368 ); CREATE( DB369 ); CREATE( DB370 ); CREATE( DB371 ); CREATE( DB372 ); CREATE( DB373 ); CREATE( DB374 ); CREATE( DB375 ); CREATE( DB376 ); CREATE( DB377 ); CREATE( DB378 ); CREATE( DB379 ); CREATE( DB380 ); CREATE( DB381 ); CREATE( DB382 ); CREATE( DB383 ); CREATE( DB384 ); CREATE( DB385 ); CREATE( DB386 ); CREATE( DB387 ); CREATE( DB388 ); CREATE( DB389 ); CREATE( DB390 ); CREATE( DB391 ); CREATE( DB392 ); CREATE( DB393 ); CREATE( DB394 ); CREATE( DB395 ); CREATE( DB396 ); CREATE( DB397 ); CREATE( DB398 ); CREATE( DB399 ); CREATE( DB400 ); CREATE( DB401 ); CREATE( DB402 ); CREATE( DB403 ); CREATE( DB404 ); CREATE( DB405 ); CREATE( DB406 ); CREATE( DB407 ); CREATE( DB408 ); CREATE( DB409 ); CREATE( DB410 ); CREATE( DB411 ); CREATE( DB412 ); CREATE( DB413 ); CREATE( DB414 ); CREATE( DB415 ); CREATE( DB416 ); CREATE( DB417 ); CREATE( DB418 ); CREATE( DB419 ); CREATE( DB420 ); CREATE( DB421 ); CREATE( DB422 ); CREATE( DB423 ); CREATE( DB424 ); CREATE( DB425 ); CREATE( DB426 ); CREATE( DB427 ); CREATE( DB428 ); CREATE( DB429 ); CREATE( DB430 ); CREATE( DB431 ); CREATE( DB432 ); CREATE( DB433 ); CREATE( DB434 ); CREATE( DB435 ); CREATE( DB436 ); CREATE( DB437 ); CREATE( DB438 ); CREATE( DB439 ); CREATE( DB440 ); CREATE( DB441 ); CREATE( DB442 ); CREATE( DB443 ); CREATE( DB444 ); CREATE( DB445 ); CREATE( DB446 ); CREATE( DB447 ); CREATE( DB448 ); CREATE( DB449 ); CREATE( DB450 ); CREATE( DB451 ); CREATE( DB452 ); CREATE( DB453 ); CREATE( DB454 ); CREATE( DB455 ); CREATE( DB456 ); CREATE( DB457 ); CREATE( DB458 ); CREATE( DB459 ); CREATE( DB460 ); CREATE( DB461 ); CREATE( DB462 ); CREATE( DB463 ); CREATE( DB464 ); CREATE( DB465 ); CREATE( DB466 ); CREATE( DB467 ); CREATE( DB468 ); CREATE( DB469 ); CREATE( DB470 ); CREATE( DB471 ); CREATE( DB472 ); CREATE( DB473 ); CREATE( DB474 ); CREATE( DB475 ); CREATE( DB476 ); CREATE( DB477 ); CREATE( DB478 ); CREATE( DB479 ); CREATE( DB480 ); CREATE( DB481 ); CREATE( DB482 ); CREATE( DB483 ); CREATE( DB484 ); CREATE( DB485 ); CREATE( DB486 ); CREATE( DB487 ); CREATE( DB488 ); CREATE( DB489 ); CREATE( DB490 ); CREATE( DB491 ); CREATE( DB492 ); CREATE( DB493 ); CREATE( DB494 ); CREATE( DB495 ); CREATE( DB496 ); CREATE( DB497 ); CREATE( DB498 ); CREATE( DB499 ); CREATE( DB500 ); while(1) { Sleep(10); } }