In my program I need to check if I have already generated a value in a set of 2.5*10^9. I expect to generate about the half of the set and need to have a fast way to check a
This may not be your problem, but try to allocate the bitset on the heap with new, instead of using the stack.
Some systems limit the size of the stack, which might be what causes problems for you.