Search found 21 matches

by Martin
Fri Jul 20, 2007 8:38 am
Forum: C++ Development
Topic: Crash on program close
Replies: 25
Views: 3654

B.t.w. my comment about possession taking functions (which arises due to the lack of garbage collection) was a general C++ comment, not a wxWidgets specific one. :-)
by Martin
Thu Jul 19, 2007 5:07 pm
Forum: C++ Development
Topic: Crash on program close
Replies: 25
Views: 3654

Some functions (or the objects they belong to) take possession of the objects passed to them via pointer parameters. They are then responsible for the deletion of those objects. The problem is: you have to know how the function you are calling behaves (which can usually only be figured out by readin...
by Martin
Wed Jul 18, 2007 7:44 am
Forum: C++ Development
Topic: Crash on program close
Replies: 25
Views: 3654

Hello HighCommander4, when I tried your program, it already crashed upon startup. I was able to fix this by moving the creation of MyFrame to the application's OnInit function. It then crashed when exiting... My guess is that it has something to do with the use of shared_ptr. Probably MyFrame does n...
by Martin
Tue May 29, 2007 1:33 pm
Forum: C++ Development
Topic: Memory Leak?
Replies: 12
Views: 1118

Hi Lucky75,

this looks similar to this problem:

http://forums.wxwidgets.org/viewtopic.php?t=13208

The conclusion was, that probably the underlying runtime system keeps the memory for later allocation requests.
Maybe it is the same here?


Cheers,

Martin
by Martin
Fri Mar 30, 2007 9:37 am
Forum: C++ Development
Topic: wxGrid's XToCol and YToRow seem to be flawed
Replies: 1
Views: 497

If I set the column and row label sizes to 0, YToRow and XToCol work perfectly. //--- Create a grid ------------------------------------------------------- m_grid = new wxGrid(this, wxID_ANY); m_grid->CreateGrid(300, 8); m_grid->SetRowLabelSize(0); m_grid->SetColLabelSize(0); Does this mean that I h...
by Martin
Wed Mar 28, 2007 1:04 pm
Forum: C++ Development
Topic: How to detect the presence of the scrollbars on wxScrolled
Replies: 1
Views: 305

Hi cavolaccimiei,

could comparing the values returned by GetSize() and GetVirtualSize() be a starting point? I am not sure though whether the virtual size is dependent on the presence of the scrollbars.

Martin
by Martin
Wed Mar 28, 2007 12:46 pm
Forum: C++ Development
Topic: wxGrid's XToCol and YToRow seem to be flawed
Replies: 1
Views: 497

wxGrid's XToCol and YToRow seem to be flawed

Hi folks, there (wxGTK 2.8.3) is a problem with wxGrid's XToCol and YToRow functions. They return -1 for the last column and row. (Are the row and column labels not taken into account?) And they seem to become more and more imprecise for high column/row numbers (if there are many columns/rows). The ...
by Martin
Mon Mar 19, 2007 3:48 pm
Forum: C++ Development
Topic: wxString memory usage question
Replies: 8
Views: 1466

Frank and alamgir99, I think you are right. I played around a little more with the above toy program. If I allocate hundreds of thousands of small objects, and then delete them, only a few MBs are returned to the system. If I allocate only a few hundred very large objects and then delete them, then ...
by Martin
Sat Mar 17, 2007 9:38 am
Forum: C++ Development
Topic: copying unsigned char array?
Replies: 2
Views: 886

Just guessing here, but the length could be

wxImage::GetHeight() * wxImage::GetWidth()

I would try something like this:

Code: Select all

  unsigned char* alphaCopy = new unsigned char[length];
  memcpy(alphaCopy, wxImage::GetAlpha(), length);
How does your memcpy code look like?
by Martin
Sat Mar 17, 2007 8:31 am
Forum: C++ Development
Topic: problem with array of pointers!
Replies: 6
Views: 889

My first guess would be that the line

wxStaticText* a[5];

should move (or be copied) from the header file to an implementation file. Since in the header it is only a declaration, which does not allot any memory for the array.
by Martin
Fri Mar 16, 2007 2:43 pm
Forum: C++ Development
Topic: wxString memory usage question
Replies: 8
Views: 1466

That's an interesting point. But in my "real" application I also allocate a lot of selfmade objects. When I delete them the memory usage of my program decreases immediately. My rather simple classes are of course different from the reference-counted wxString. Maybe I should try to allocate objects f...
by Martin
Fri Mar 16, 2007 2:09 pm
Forum: C++ Development
Topic: wxString memory usage question
Replies: 8
Views: 1466

Thanks for the hints.

I also tried it with

Code: Select all

  vector<wxString>
and

Code: Select all

  wxArrayString
but to no avail...
by Martin
Fri Mar 16, 2007 11:37 am
Forum: C++ Development
Topic: wxString memory usage question
Replies: 8
Views: 1466

Here is a small complete application that shows why I was thinking about a memory pool. If I for example call "Allocate Strings" twice, and then "Delete Strings" the amount of occupied memory does not decrease (regarding to 'top'). Afterwards I can allocate strings twice without an increase in alloc...
by Martin
Fri Mar 16, 2007 9:50 am
Forum: C++ Development
Topic: wxString memory usage question
Replies: 8
Views: 1466

wxString memory usage question

Hi there, I am writing an application that creates hundreds of thousands of wxString objects on the heap, does some computations and then deletes all these objects. Neither valgrind nor the mem_tracing-enabled debug build of wxGTK complain about memory being leaked, but the memory occupied by the pr...
by Martin
Thu Feb 22, 2007 11:51 am
Forum: C++ Development
Topic: Bug for wxGrid::SetTable()?
Replies: 3
Views: 595

Hi kpl,

well, this bug has already been discovered (-:

http://forums.wxwidgets.org/viewtopic.php?t=8227
http://sourceforge.net/tracker/index.ph ... tid=109863

I tried your suggestion and it seems to work just fine.

Have you supplied a patch?


Cheers,

Martin