• Content count

  • Joined

  • Last visited

Community Reputation

201 Neutral

About AlexB.hpp

  • Rank

Personal Information

  1. ranges and glsl

    In hlsl there is normalize()... Probably there should be something like that. But you should check this by yourself 'cause I do learn shaders for 2 months and don't know much.
  2. [?++] Memory leak checker

    Oh, many thanks again. Looks like I've fixed the old one problem with infinite loop in stl. So... Actually I've done major work on it. Ok I pretty sure that realloc is ok now. It does; [CODE] new_ptr = realloc(old_ptr, size) if (!new_ptr) return old_ptr return new_ptr [/CODE] I'll read stuff about exceptions. And figure out how it should be. I have funny stuff as one of my friends said. I have calls of delete on unregistered ptrs [CODE] Try to erase unregistered pointer 0x82f10f8! Memory leak summary: operator new (0x82f1008) missed 4 bytes in main.cpp:5 operator new [] (0x82f1040) missed 4 bytes in main.cpp:6 malloc (0x82f1078) missed 4 bytes in main.cpp:7 calloc (0x82f10b0) missed 4 bytes in main.cpp:8 realloc (0x82f10e8) missed 8 bytes in main.cpp:10 Total leaked 24 bytes Try to erase unregistered pointer 0x82f10f8! Try to erase unregistered pointer 0x82f10c0! Try to erase unregistered pointer 0x82f1088! Try to erase unregistered pointer 0x82f1050! Try to erase unregistered pointer 0x82f1018! [/CODE]
  3. [?++] Memory leak checker

    Damn it, I've stuck a little. Meet cool bug when some containers of STL use my funcs and do stucking in infinite loop. You know how it happens - you read about 1000 books of cpp and still doing this stupid mistakes in you code.
  4. Looking for a study partner at C++, SDL and OpenGL.

    I want to join you guys. I have 4 years experience in C++. Now I'm working on 2d engine with few friends of mine. I'm about 3rd month working in game dev. It's
  5. [?++] Memory leak checker

    [quote name='SiCrane' timestamp='1354131396' post='5005045'] That still doesn't handle realloc() properly. You aren't taking into account instances when size is equal to zero and you are also aren't handling null return values properly for what looks like any of the allocation functions. Your code also looks like it blows up messily if your header is included before code that uses placement new (which includes large chunks of the standard library). [/quote] Hm. I've read it already. Tomorrow I'll fix it. That bastard is really tricky, too many behaviors for just one func... About including my header - yeah it has a bug here, I know about it. I'll describe it in docs. Have no ideas now. Thank you. [quote name='e?dd' timestamp='1354134791' post='5005058'] Some other problems:[list] [*]void* operator new[] is missing a 'return'. [*]Not exception safe (meaning that somewhat ironically, it can cause leaks). [*]Causes problems with existing placement-new overloads (though working around that is probably very tricky). [/list] [/quote] Many thanks. Still need some tests. It's in todo list. About placement new... I'll keep it in mind.
  6. Read opened thread for this problem to find out better solution. It's really interesting.
  7. [?++] Memory leak checker

    [quote name='SiCrane' timestamp='1354124673' post='5005006'] Probably not, but I wouldn't know for sure unless I saw the complete context for your code. Either way it doesn't address the issue of properly copying the data in the buffer that realloc() is supposed to do. [/quote] To prevent all misunderstandings I've implemented it via original funcs. Also I have improved output: [CODE] Memory leak summary: operator new (0x83af008) missed 4 bytes in main.cpp:5 operator new[] (0x83af040) missed 4 bytes in main.cpp:6 malloc (0x83af078) missed 4 bytes in main.cpp:7 calloc (0x83af0b0) missed 4 bytes in main.cpp:8 realloc (0x83af0e8) missed 8 bytes in main.cpp:10 Total leaked 24 bytes [/CODE]
  8. [?++] Memory leak checker

    [quote name='SiCrane' timestamp='1354113215' post='5004970'] Your realloc() implementation is definitely wrong. As it is, it [i]creates[/i] a memory leak. If realloc() returns a new address, the old allocation needs to be freed. Also, the data copy doesn't properly handle the situation where the new size is greater than the old size. [/quote] Many thanks about this issue with old ptr. Yeah I knew about greater size then old ptr had. Will it be ok if i'll do memset(new_ptr, 0, size)?
  9. [?++] Memory leak checker

    [quote name='wqking' timestamp='1354096944' post='5004907'] Good start. But reporting leaks with only addresses is not quite helpful. I would like to know the call stack and the class name, if possible. [/quote] I'm planning such output: [CODE] Memory leaks summary: operator new in main.cpp:34 (0x0fa43d41) allocated 4 bytes ... [/CODE] What output would be enough informative for you? [quote name='Dynamo_Maestro' timestamp='1354102278' post='5004932'] I forgotten the method (since this technique ironically reports smart pointers as leaks heh) but MFC has a pretty decent way of checking for leaks already even if you arent making MFC apps, heres the link anyway [/quote] I'm making it as cross-platform solution. But however thanks.
  10. [?++] Memory leak checker

    Added malloc, calloc, realloc and free wrappers. Added gitignore. I have a question about realloc. Does it reallocate of incoming pointer? Is it correct in my code?
  11. [?++] Memory leak checker

    [quote name='SiCrane' timestamp='1354058338' post='5004731'] Don't forget calloc() and realloc(). realloc() is always a fun one to deal with because depending on how you call it, it can also act like malloc() or free(). [/quote] Thx for calloc don't even know about it.
  12. [?++] Memory leak checker

    [quote name='ApochPiQ' timestamp='1354056553' post='5004714'] [code]#include <malloc.h> #include "allocation_hooks.h" int main() { void* foo = malloc(1024); check_map(); // No leak reported. }[/code] [/quote] Cause there is no malloc overloading. Will add to todo list. Thx [url=""]1st issue[/url] added.
  13. I've started working on simple and little class for C++ to check some memory leaks. I have made some work on it, but there is a lot of work to do. I'm planing to add cppunit, autoreconf, documentation, static class instread of global functions, different loggers. Now it has: shared library, header with some funcs declarations, makefile to build it via g++, simple script to test it, linux only but I'll port it to win after some researching. I do it for my own project but I would like to share it with a great pleasure. Now it looks like this [CODE] alexb leak_checker> ./ MEMORY LEAK! 0x8c1a008 main.cpp 5 MEMORY LEAK! 0x8c1a038 main.cpp 6 [/CODE] with such main: [source] #include <iostream> #include "allocation_hooks.h" int main(int argc, char** argv) { int* num = new int; num = new int[1]; check_map(); } [/source] Repo is [url=""]here[/url]. PS Warning it has some magic in it!
  14. Stuck on newbie project

    [quote name='Nausea' timestamp='1353942090' post='5004205'] AlexB.hpp: I take it you´re joking? ... [/quote] Don't be mad about that... I didn't mean any stupid stuff. I wanted to said that you have a great possibility to make a nice game and take a lot of experience. Some time I write/say totally strange things, but it's ok for me. That's how I start deep thinking.
  15. Stuck on newbie project

    You need collision detector cauze bullets gets thought terrain. Actually there is a lot of possible improvements. Does your character can shot only horizontal ax? Are there any other types of weapons? What about some enemies? What about twitter or smth else in it? Does it have achievements? --- Looks like my English still pretty bad if I couldn't talk what I want.