Seems that Gambas still owns that address, but it is not "protected" anymore and so it can be used to other purposes. I'm not sure when Gambas *actually* frees that address.
There are fundamental problems when you compare C/C++ and any basic language in this way. Same line in C may mean very different thing than in basic. Basic languages are high level languages ( http://en.wikipedia.org/wiki/High-level_programming_language ), they hide much from you about what actually happens. Even one simple line of code in basic can mean many many lines in machine code. That makes them user friendly (you don't have to know all details and write so much code), but also slower. Hello world, in assembly (low level language); section .text global _start ;must be declared for linker (ld) _start: ;tell linker entry point mov edx,len ;message length mov ecx,msg ;message to write mov ebx,1 ;file descriptor (stdout) mov eax,4 ;system call number (sys_write) int 0x80 ;call kernel mov eax,1 ;system call number (sys_exit) int 0x80 ;call kernel section .data msg db 'Hello, world!',0xa ;our dear string len equ $ - msg ;length of our dear string in C (not *that* low level); #include<stdio.h> main() { printf("Hello world"); } in Gambas (high level language); Public Sub Main() Print "Hello world" End Gambas uses technology called bytecode interpreter. http://en.wikipedia.org/wiki/Interpreter_%28computing%29 Jussi On Tue, Jan 11, 2011 at 19:32, Demosthenes Koptsis <demosthen...@gmail.com>wrote: > Hi, > > i study the cases of pointers and i found at this page > http://www.yolinux.com/TUTORIALS/C++MemoryCorruptionAndMemoryLeaks.html > > cases of program crashes from bad usage of pointers. > > i made a test for > Attempting to write to memory already freed. > > --------------------------- > ' Gambas module file > > Public Sub Main() > > Dim pPointer As Pointer > Dim hMemory As Stream > > pPointer = Alloc(SizeOf(gb.Integer)) > hMemory = Memory pPointer For Read Write > > Print pPointer > > Free(pPointer) > > Write #hMemory, 10 As Integer > > Print pPointer > Print Int@(pPointer) > Print pPointer > > End > --------------------------- > > in this example i free the pointer and then try to write to it. > The result is that i can write and read normally after Free(pPointer) > > Is this ok? > > -- > Regards, > Demosthenes Koptsis. > > > > ------------------------------------------------------------------------------ > Protect Your Site and Customers from Malware Attacks > Learn about various malware tactics and how to avoid them. Understand > malware threats, the impact they can have on your business, and how you > can protect your company and customers by using code signing. > http://p.sf.net/sfu/oracle-sfdevnl > _______________________________________________ > Gambas-user mailing list > Gambas-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > ------------------------------------------------------------------------------ Protect Your Site and Customers from Malware Attacks Learn about various malware tactics and how to avoid them. Understand malware threats, the impact they can have on your business, and how you can protect your company and customers by using code signing. http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user