4.1 with betas: FreeMemory()

Everything else that doesn't fall into one of the other PB categories.
T-Light
User
User
Posts: 45
Joined: Sat Aug 05, 2006 5:42 pm
Location: UK

Post by T-Light »

And thanks for the clarification on the docs Fred :)
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Hi Fred, i posted a post in bugs section 4 or 5 days ago, in which was explained 5 possible bugs. The post has dissapeared, and i think none of the reasons you mention is happening.
Freak answered about my post points 1, 2, 4 and 5, but point 3 was not answered, and it is not fixed (i think), but i don't remember what was it :o
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

Post by Shannara »

That is weird, I posted this concerning freememory awhile back found @ http://www.purebasic.fr/english/viewtopic.php?t=23930 , however that was a bug report that was silently deleted ... It was even referenced @ http://www.purebasic.fr/english/viewtop ... freememory as proof of deletion. As Fred mentioned, there's no point in him silently deleting bug report threads. Since it wasnt Fred, then someone else is doing that.

Trond was able to make a workaround until the issue as resolved. Which turned out to be the same work-around posted here :) It still works for me.

Also:

Macro CloseWindowSafe(Win)
CloseWindow(Win)
Win = 0
EndMacro

is needed or PB will crash after so many open and close window calls.
Fred
Administrator
Administrator
Posts: 18351
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Here is the freememory() code (wow, an official PB piece of code !):

Code: Select all

/*
 *  FreeMemory() command for PureBasic
 */

#include "MemoryPLUGIN.h"


M_PBFUNCTION void PB_FreeMemory(char *Memory)
{
  HeapFree(PB_Memory_Heap, 0, Memory);
}
Please find a bug in it. I seriously think i can be almost sure when we said there is no problem with the FreeMemory() code. The problem is somewhere else in the code.

Macro CloseWindowSafe(Win)
CloseWindow(Win)
Win = 0
EndMacro
Again, please prove it, as it seems like a non-sens for me.
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

Post by Shannara »

Open, close windows :) Do that a few times without rebooting the application. Pristo. The code posted above fixes that. I dont know whats going on with the freememory, and why it does as it do. All I do know, is that the FreeMemorySafe macro fixes that as well. :?
freak
PureBasic Team
PureBasic Team
Posts: 5948
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

All the close/free functions are save as long as you call them with valid IDs. Call them
with any other value (for example an allready freed memory block), and boom.
So we can be almost certain that the problem is your code if you have trouble like that.

So show the code so we can analyze it, or shut up.
quidquid Latine dictum sit altum videtur
Fred
Administrator
Administrator
Posts: 18351
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

As Trond explained, if you use the pointer to an already freed memory block, no wonder than you get unexpected results... Putting it back to 0 after each FreeMemory() just silently hide your program bug, nothing more. The same stands for OpenWindow(), if you use it with #PB_Any.
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

Post by Shannara »

Fred: Thank you for the response and code snippet. It's always cool to see some of the underline code of PB :)

---

Freak: I posted the example on the thread a forum mod silently deleted. I will repost here, but please don't be rude.

We can actually use Trond's example on PB 4.0:

Code: Select all

Memory = AllocateMemory(49)
Debug MemorySize(Memory)
FreeMemory(Memory)
Debug MemorySize(Memory)
4.01 have this memory thing fixed. I left in the previous macro in as it would require a code change across tons of files..

As for the Windows issue, I will be more then happy to post the code if you can garentee a forum mod won't delete the thread.
Fred
Administrator
Administrator
Posts: 18351
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

You code is wrong, you can't call a function on an already freed object. Is that hard to understand ?
Fred
Administrator
Administrator
Posts: 18351
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Shannara wrote:As for the Windows issue, I will be more then happy to post the code if you can garentee a forum mod won't delete the thread.
Ha, i missed this last sentense.

One more like this and you won't be able to post on the forum at all. I am the only one with delete rights on this forum section, and i do that carefully. Therefore i won't accept these kind of remarks. Am I clear enough or ?
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

Post by Shannara »

Warning: this is a extremely long thread, community is recommended to read all the way through to know what have been going on.

Fred:

Thanks for bringing that out into the open instead of PM. The community need to see what is really going on. This may seem like a rant. But every single fact stated in here is 100% true. This is proven by simple searches on the forums, and the PMs going between you and I, as well as IRC logs. I even hate having to type this post, but I am tired of being jerked around left and right. And threatened banned over something I am not responsible for. I have been civil and had my head bitten off. No more.

So what am I to do? You tell me. Freak requested something. The last time I posted something similar to Freak’s request, the thread was deleted. You just stated that you are the only one with the power to delete threads. Before that, in this very thread you stated that it would be pointless to delete bug reports. Now you threaten to ban me for pointing that out. This mean, you deleted the fore mentioned thread. This cannot be denied, as it was admitted to in this thread.

How the heck am I to even provide code when it is deleted? You keep saying things are against the rules, when none are listed. I requested forum rules to be posted on the forums so people actually know whatever they are, and I've been ignored. It is not fair to the community to be chewed out for going against unwritten rules. The only thing to go by is your and the other staff member posts.

How are new community members going to know any rules unless they are posted, in public? You can’t honestly expect all new members to run a search on every staff members in the forum, go through all the posts, to try and figure out which are rules and which are not? I know these are not normal run of the mill rules either. By staff responses to my and other people’s threads show that. Even though my last requests for rules have been ignored, I will ask one last time.

When I do as requested, my threads get deleted, and at times credit is taken. Then I get threaten again, and am told you have no time for me. This is really simple. Post the rules, and abide by them. Quit threaten to ban people who do as you request.

I will not be stuck in the middle of contradictions again, and have time wasted because of it. I am asking you in public, Fred. Are we permitted to post bug reports and sample codes? And I am not asking for just myself. I am asking for other people and future customers. What you post in this thread and all other threads are used as references.

I know I may be banned for this. But the community and future customers making decisions on whether or not to buy Purebasic, really depends on you and your actions. On whether people can expect to be banned for doing as requested or actually thanked as proper?

Is it safe for people to even buy PureBasic and the support, when they could be banned from support at any time? This has happened twice now to myself. No reason, no explanations, only to be threatened banned from the forums. I have not cause problems in the community. Doing a search under my name proves that. I am not even saying that PB is a bad product at all. I only have issues for being banned from two avenue of support (as in the receipt), with being removed of the last way of support. And from staff contradicting each other and me being threatened banned because of it.

Why threaten banned when all you have to do is quit contradicting yourselves and realize that when you ask for something, you should expect getting it, not ban people for giving what you ask.

Yes, this is a long winded post. But I am tired of being jerked around, having two avenues of support taken away (email, irc), and the third one threatened. What is the use of selling PureBasic and support (your selling both for the price), when you’ll take them away for literally, no reason given?

I apologize to everybody else in the community. This have been boiling for a very long time, and I believe the community have the right to know what will happen to them (and to some of you, it has already started), if this continues on.

Fred? Banning does not solve anything, nor help solve anything when the problem is not purebasic, and is not the community, but the way staff handles the community.

I am not looking for a ban. None of my posts have warranted such. A search shows that, but it is never considered. I don’t think I need to repeat myself because it always fall on deaf ears. A 5 minute research backs up everything, but that is never done. This is down right harassing me.

This may be my last post. If I am banned, then at least the facts are known and the warning is given. If I am not, then maybe there is hope yet.

~Shannara~
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Guys, please be patient and understand ones to each others, and never be mad, etc.
@Shannara, as Fred said, your last code sample is wrong, and Freak advertised about FreeMemory() behaviour before you posted that wrong sample code, just please understand it.
@Fred please delete only the posts which fall at least into one of the conditions you defined above, but not others. Because correct bug reports are very useful for PB developing, aren't them?
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

A lot of posts were suddenly gone from another topic once, but they weren't deleted. I think that was a forum bug. This could also be a forum bug or a misunderstanding. Since the server gives internal errors quite often there must be something wrong somewhere inside it (!).

Anyways, my experience is that as long as you NEVER EVER do things like measuring the size of something that doesn't exist, or try to free something that doesn't exist, the memory and other functions are bullet-proof.
Program flow must be made so that a FreeMemory() or MemorySize() function never gets an invalid parameter and everything will work.
freak
PureBasic Team
PureBasic Team
Posts: 5948
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

Ok, a long post here as well. Please read it fully, and really consider my points.

First of all:
You make it sound like this is a general problem, like every user here has trouble, because
they don't know what to do, because there are no clear "rules" to follow.
Let me ask you this: Why are you the only one having this kind of trouble, and no one else ?
Why has Trong submitted tons of more bug reports than you, even gotten into rather heated
discussions over some of them with Fred or myself, yet never been banned or treatened to ?

Let me tell you that the ban list in this forum has only 6 people in it. 2 of them are
people who spreaded illegal copies in here, and the other 4 were spam related as far as i remember.
Now, compare that to the average forum out there, and you will see that this is a very low number.
The very fact that you are still here should tell you something.
So you can hardly say that this is a general problem in here. That users don't know
how to behave and get banned as a result.

Think of this for a while before you read on. Maybe the problem is you, not us or the commutity ?

Next:
I am not looking for a ban. None of my posts have warranted such. A search shows that, but it is never considered. I don’t think I need to repeat myself because it always fall on deaf ears. A 5 minute research backs up everything, but that is never done. This is down right harassing me.
Yes, there were many posts, that would have been enough a reason to get you banned.
The fact that your post record is clean of such posts is quite obvious: They had to be deleted because of their content.
As much as i'd like to have some of them still available to prove my points,
its obvious that we have to delete such that damage the Image of PureBasic.
(for example such that contain downright lies, which you posted more than once in your time here)
Those who have been here long enough may remember some of those. Those
that are new here really don't need to know.

So, lets get to the problem we have with you (which were the reasons for the ban warnings)
I think any thinking person will agree that what i list below is nothing that
must be carved in stone to be accepted as a rule. This is all simply common sense.

Lets start with some stuff that actually are "written rules" in here, that you clearly did not follow on many occasions.
Have a look at the top of the bug forum and read carefully: http://www.purebasic.fr/english/viewtopic.php?t=4701
(3) Have you triple-checked your code? Sometimes we make the simplest of mistakes, and post "bugs" only to find out we forgot something.

(4) If something doesn't "seem to work", then post it in the Questions section first, unless you know it's a bug. A lot of times a bug is just lack of knowledge by a newbie of how to use a command correctly.
I can no longer count the number of false bug reports that came from you.
Usually it is just an error on your behalf, but you post them here, ranting about how buggy PB is.

Now, this in itself is no problem. There are many bug reports that turn out to be user problems. This is not the point.
The problem with you is that you keep insisting that PB libraries are buggy,
even after we have clearified that the problem is your code and not PB.

Take this thread as an example. We clearified that FreeMemory() is a save function as long
as it is given correct input. Yet still you claim that there are problem, and that you
reported this and some evil moderator deleted your post. (i mean this: http://www.purebasic.fr/english/viewtop ... 359#170359)
The reason that this post was deleted was because there is no more bug.
FreeMemory() does not have any problems, and MemorySize() has been fixed a while ago.
Posts in the bugs section are deleted when the bug is fixed, as Fred explained earlier.

Another example lies quite a while back, but i remember it quite clearly:
It was a bugreport of yours that went on to like a 6-8 page long thread,
where i pointed you to the error in your code multiple times. I even provided lengthy
examples proving beyond doubt that the command did what it was supposed to do,
yet still you ranted about how buggy this library is and that we should get it fixed.
(you may remember this thread as well. It was the one where you managed to get me so mad
that i used an "evil" word in the end which caused quite some uproar in the forum. :wink: )

It should be obvious to the outside observer why such things are making us mad.

This is not even limited to the bugs forum. Posts like "The lib XXX is so buggy, it cannot be used."
have been found from you all over the forum, where you could never prove the cause for your accusations.
I even remember one time where you told a potential new customer on this forum that the PureBasic email support
is quote: "not responding to any emails", just because one of your emails was identified as spam and blocked.
This is what i call spreading downright lies and false information. And yes, that is enough reason for a ban.

Some more "written rules" for you, from the post above.
(7) If you've found something that seems to be a real bug, then try to narrow it down to a small section of code, and post that code with your report. It's hard to help if we can't see exactly what you're doing.

(8 ) Post a description of the bug with the code (not just code alone), unless the bug is extremely self-evident. We'd like to know what the the problem actually is, instead of just running your code and hoping the problem will be obvious.
Take this very thread once again. You state that CloseWindow() crashes when you call it too often. That, and nothing more.
Where is the code to back up your statement? Where is the detailed description of the bug ?
I could bet my hat that this is just another mistake in your code.

Once again, it is not this single instance that is the problem. It is the general attitude of
running around the forum telling everyone feature X and Y are buggy without
the slightes shred of evidence that would prove your statement.

Now don't tell me you had the evidence posted and the evil moderators deleted them again.
We have been over this. Fred stated the rules for deletions in the bugs section clearly,
and i repeat again: He is the only one who deletes posts here. nobody else.
Posts are deleted when the bug is deemed fixed or not reproducable. If in any
case the bug still persist, it can be reposted in a polite manner. Accusing us
of conspiring to delete your posts is the wrong route to go here.


You want "written rules" ? These were there since a long time, and clearly you do not follow them.

Basically the problems with you can be boiled down to a few simple things:
* Spreading false information and downright lies about PureBasic.
* Accusing the team/moderators of things they did not do, without any proof.
* Wasting our time by insisting on problems being there which we clearified are not. (once again without a shred of proof from you)

So, do we need to put these points on the front page of the forum, so people do not need to be afraid to break any rules ?
Seriously, this is common sense. You cannot expect to be treated nicely in any forum
if you step on the toes of all the staff members on a continuing basis, and
then accuse them of being the problem.

Think about it: What would happen if you called phone support of any company
and start accusing the guy on the other end of all kind of things, annoying him to no end.
What kind of quality sevice do you expect there ?
It is no different in a forum. This is a service that you did not have to pay for,
and it was not part of your buying PureBasic. So yes, we can deny this service to anyone we want.

Now, so far you have never been actually banned. Only warned of the possibility.
Once again i say: Do you see other people get such warnings/bans? Is this a common thing around here?

You should take such warnings to heart, and think seriously about what (in the particular situation at hand)
may have promted the warning, instead of coming right back at us with more accusations like in your post above.
One day, this very thing may get you banned just as well.

Once again, the ban record in this forum is very low. In many other forums i know, you would have
been banned a long time ago. You should take this as an indication that
we "staff" do not manage things as bad here as you say you do.

Think about these points. The problem here is not us. It is you.
btw, it took me about an hour to write this response, so don't think you are the only one who's time is wasted by this.

To the community:
I am sorry for this. Please do not think this is a common situation. This is a very special case that has been going on and off for years allready.
Those of you who were here long enough know what i am talking about.

Let me clarify this again:
We need to get bug reports from the community to develop PB further. Unlike Shannara says above, we very much welcome such reports.
False reports or user mistakes are no problem at all, as long as the poster
can accept that fact, when we respond and point out the error in the code.
We can differ in opinion. No problem with that. But keeping spreading wrong
information after we clearly clearified it, or going on a rant is simply not the polite was to go.

We keep the moderating of this forum as low as possible. Locked topics, deletions or bans
are a very rare thing here. (except the deletions in the bugs forum as explained by Fred)

We are just people too though, and cannot take such stuff forever without reacting.
I hope you understand that.

Thanks.
quidquid Latine dictum sit altum videtur
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

freak wrote:Ok, a long post here as well. Please read it fully, and really consider my points.

First of all:
You make it sound like this is a general problem, like every user here has trouble, because
they don't know what to do, because there are no clear "rules" to follow.
Let me ask you this: Why are you the only one having this kind of trouble, and no one else ?
Why has Trond submitted tons of more bug reports than you, even gotten into rather heated
discussions over some of them with Fred or myself, yet never been banned or treatened to ?
Exactly what I told him a while ago:
http://www.purebasic.fr/english/viewtop ... 829#157829

By the way, CloseWindow() has no problems. I had a problem with CloseWindow() as well, but it turned out to be mostly a bug in my code and also a small bug in the beta version, which was fixed for the final version.
Locked