www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/10/24/13:14:56

Date: Tue, 24 Oct 1995 17:59:15 +0200
From: Keren Yaron <yak AT techunix DOT technion DOT ac DOT il>
To: eliz AT is DOT elta DOT co DOT il
Subject: Re: sprintf leaks memory?
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu

Here are the results of running the test program:

go32 version 1.12.maint3-disp Copyright (C) 1994 DJ Delorie    
13697024                                                       
    -0.010                                                     
13664256                                                       

Is it reasonable that sprintf allocates 33K?

The test program is:

#include <dpmi.h>
#include <iostream.h>
#include <math.h>
#include <stdio.h>

main() {
  char s[100];

  cout<<_go32_dpmi_remaining_physical_memory()<<endl;
  sprintf(s,"%10.3f",-0.01);
  cout<<s<<endl;
  cout<<_go32_dpmi_remaining_physical_memory()<<endl;

  return 0;
}


Compiled with 
gcc leak.cpp -lgpp

Yaron

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019