dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

Search:

Type: Posts; User: Tannin

Page 1 of 2 1 2

Search: Search took 0.02 seconds.

  1. Replies
    10
    Views
    6,691

    Re: c++ allocators thread-safe?

    Ok, you're right, it would seem as if that last example program (the pure C code) indeed ran out of memory.
    My question is still not answered though: The original program bad_allocs with 250 threads...
  2. Replies
    10
    Views
    6,691

    Re: c++ allocators thread-safe?

    because top says the process has 0.0 - 0.1% memory consumption. ;)




    top



    umm, no? The maximum for EACH processes is 3 GB. Each process has its own virtual address space of 2^32 bytes, 1...
  3. Replies
    10
    Views
    6,691

    Re: c++ allocators thread-safe?

    Interesting thought. I wrote a test program that was supposed to create a lot of threads, all trying to lock the same mutex. Locking the mutex never failed, but it turns out I'm not even able to...
  4. Replies
    10
    Views
    6,691

    Re: c++ allocators thread-safe?

    I've rewritten the test to be less obscure and C-only:



    #include <pthread.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <errno.h>
  5. Replies
    10
    Views
    6,691

    Re: c++ allocators thread-safe?

    Hi,

    unfortunately I won't be able to test again until monday. As far as I remember I wasn't able to reproduce the problem with the function call commented out.

    Also, googling a bit it seems as...
  6. Replies
    10
    Views
    6,691

    Re: c++ allocators thread-safe?

    I extended the sample a bit with overwritten versions of new and new[] that now explicitly lock a mutex before allocating memory:


    static pthread_mutex_t NewMutex;

    void* operator new(size_t...
  7. Replies
    10
    Views
    6,691

    c++ allocators thread-safe?

    Hi,

    I have been experiencing crashes in a heavily multi-threaded application (up to 1000 threads), that were always related to memory allocation (usually a std::string being resized).

    Now, if I...
  8. Replies
    11
    Views
    1,515

    Re: Weird new-behavior

    Hi,

    I'm very sorry if my last post offended people. Personally I consider MFC a part of VC since it's shipped with it and since compiling a MFC Application does not emit a deprecation warning I...
  9. Replies
    11
    Views
    1,515

    Re: Weird new-behavior

    You are right Philip, catch (...) catches an exception. After some debugging and googling it turns out VC++ violates the standard (again...) by overloading new to throw a CMemoryException which does...
  10. Replies
    11
    Views
    1,515

    Re: Weird new-behavior

    Sorry if there has been confusion. The catch-block is never entered, there is no code in the application to create this messagebox.

    -----------------------------------
    Exception handling is set...
  11. Replies
    11
    Views
    1,515

    Weird new-behavior

    Hi,

    I'd like to post a problem on behalf of a colleague and would appreciate your help:

    -----------------------

    I do have a wicked behaviour regarding dynamic memory allocation with the new...
  12. Thread: NULL reference?

    by Tannin
    Replies
    4
    Views
    1,088

    Re: NULL reference?

    Under the hood, a reference is most likely a pointer anyway. The constraints (no reassignment, no initialisation) only allow the compiler to do some more tests. But if you put enough effort into it,...
  13. Replies
    4
    Views
    1,272

    Re: Delay Code Execution

    Hmm, I don't know the capabilities of the M16C, but the usualy C functions to sleep for short periods are usleep (unistd.h) or nanosleep (time.h).
    As an alternative you could use select (requires...
  14. Replies
    9
    Views
    2,358

    Re: Odd behaviour in overloaded std::stringstream

    Nooo, sorry I didn't post earlier, but I didn't want to post before I compare what Paul posted with what linux does:

    disassembling the code g++ produces I can verify that it calls

    ...
  15. Replies
    9
    Views
    2,358

    Re: Odd behaviour in overloaded std::stringstream

    Thank you for your responses.

    The fact that std::ostringstream is not copyable is not a problem, because
    a) I do not require the copy of stupidostream to be a proper copy of the original because...
  16. Replies
    9
    Views
    2,358

    Odd behaviour in overloaded std::stringstream

    Hi,

    I'm having a problem with overloading std::stringstream.
    What I'm trying to achieve is a stringstream that is instantiated only as a temporary and outputs its content on destruction.

    Here...
  17. Replies
    11
    Views
    1,095

    Re: gcc ignores const before template parameter?

    @laserlight: thanks. Yes, I will have to adjust it to our internal coding standards.
    @treuss: since programmers other than myself may have to use the code and instantiate FooBar, I'd prefer to move...
  18. Replies
    11
    Views
    1,095

    Re: gcc ignores const before template parameter?

    thanks for your input.

    phl's solution seems to do what I need.
    Using const as the template parameter doesn't work in the actual program because I also need to provide a "retrieveValue(PAR1*...
  19. Replies
    11
    Views
    1,095

    Re: gcc ignores const before template parameter?

    that does make sense, thank you. Too bad there is no nicer way than to cast...
  20. Replies
    11
    Views
    1,095

    Re: gcc ignores const before template parameter?

    thank you for your response.

    Why does "const PAR1&" translate to "char* const&"? Is there no way to formulate this so that the class actually created has a constructor "Foobar(const char*&...
  21. Replies
    4
    Views
    1,386

    Re: UTF-8 -> wstring -> UTF-8?

    Maybe C++0x will contain something like this, but for now, it's just a mess.
    the problem with the std::string is that you can not only not retrieve the correct length, you also can not correctly...
  22. Replies
    11
    Views
    1,095

    gcc ignores const before template parameter?

    compiling the following code I get the error
    "test.cpp:11: error: invalid conversion from ‘const char*’ to ‘char*’
    test.cpp:11: error: initializing argument 1 of ‘Foobar<PAR1>::Foobar(const...
  23. Replies
    4
    Views
    1,386

    Re: UTF-8 -> wstring -> UTF-8?

    you're screwed. ;)
    Sorry to put it so bluntly but character encodings are just a terrible mess in C/C++.
    Before you start, please realize that neither std::string nor std::wstring are aware of...
  24. Replies
    7
    Views
    755

    Re: multiple definition

    Thanks to you two, this seems like a good suggestion. I'll try that.
  25. Replies
    7
    Views
    755

    Re: multiple definition

    Thanks, but that doesn't help, because it only prevents including multiple times inside one "translation unit", it doesn't prevent two "translation units", in this case A and B, from containing the...
Results 1 to 25 of 42
Page 1 of 2 1 2


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)